linux - Ubuntu -If command seems do not provide else outcome -
i not understand why if script not working. when have internet connection in linux displays online phrase. when have no internet connection still displays online phrase instead offline. #!/bin/bash # system_page - script monitor various connections , produce # system information in html file ##### constants title="monitor information $hostname" right_now=$(date +"%x %r %z") time_stamp="updated on $right_now $user" # clear screen clear echo -e "get http://google.com http/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 function net_info { if [ $? -eq 0 ]; echo "online" echo "<h2 style="background-color:#00ff00"><font size="6"> internet connected</h2>" else echo "offline" echo "<h2 style="background-color:#ff0000"><font size="6"> internet not connected</h2>" fi } ##### main cat <<- _eof_ <html> <head...