[NBLUG/talk] shell scripting help
seanvanco at gmail.com
Tue Jun 10 15:46:01 PDT 2008
I found that after about a half hour of sending the e-mail, and I also
cleaned up a few syntax errors. My current iteration is below, and it
does loop and terminate correctly. The only odd thing is that the time
between each ping is 37 seconds apart instead of 30.
If anyone has any idea why it's taking the extra 7 seconds, I'm
curious to see what I did wrong. Otherwise this will work for me.
while [ $time -le 180 ]
if [ -z "$1" ]; then
echo "Usage: `basename $0` ip-addr"
ping -c 1 $1 &>/dev/null
if [ $? -eq 0 ]; then
echo "Ping succeeded"
# Commands here
echo "Ping failed"
time=`expr $time + 1`
More information about the talk