Created
December 25, 2021 16:00
-
-
Save medanisjbara/e99e785b7e7685a8fad6d9422e6b2a58 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 0 ] && [ $# -ne 1 ] | |
then | |
echo "invalid number of arguments" | |
exit 1 | |
elif [ "$1" = "-h" ] | |
then | |
echo help | |
exit | |
elif [ "$1" -eq "$1" ] 2>/dev/null | |
then | |
echo "script started with value of $1" | |
elif [ ! "$1" ] | |
then | |
echo "script started with default value 2" | |
else | |
echo "numeric value or -h" | |
exit 1 | |
fi | |
while true | |
do | |
printf . | |
if [ "$(wifi|grep off)" ] | |
then | |
echo | |
echo "it's off" | |
echo "enabling wifi" | |
wifi on | |
fi | |
sleep ${1:-2} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment