Skip to content

Instantly share code, notes, and snippets.

@medanisjbara
Created December 25, 2021 16:00
Show Gist options
  • Save medanisjbara/e99e785b7e7685a8fad6d9422e6b2a58 to your computer and use it in GitHub Desktop.
Save medanisjbara/e99e785b7e7685a8fad6d9422e6b2a58 to your computer and use it in GitHub Desktop.
#!/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