Some very useful bash scripting tips for testing the output of a program.

This simple shell script will test your Internet connection and then tell you if it is up or not. wgetvar=$(wget -q –tries=3 –timeout=20 –spider http://google.com)   if [ $? -eq ‘0’ ] then echo "Internet is up." else #some logging echo "Internet is down.." fiwgetvar=$(wget -q –tries=3 –timeout=20 –spider http://google.com) if [ $? -eq ‘0’ … Read more