loops - Bash Exit Status codes for Ping -


i working on small script checks if host or down.

until [ "$status" -eq "0" ] ping -c 1 192.168.0.3 echo host down status=`echo $?` done 

it supposed change status 0 if pings host , exit until loop. doesnt. if echo out value of $? value zero.

can me figure out please? :)

thanks in advance

you have echo host down after ping command. $? takes exit status of echo command not ping command.

ping -c 1 192.168.0.3 status=$? if [ $status -ne 0 ];    echo "the host down" fi 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -