network script syntax problem

Jude DaShiell <[email protected]>
Newsgroups gmane.linux.redhat.blinux.general
Message-ID <[email protected]>
#!/usr/bin/env bash
# file: $0 - script to find useable connection on hughsnet.
let CONNECT=0
while [ $CONNECT -lt 1 ]; do
     sudo -H dhcpcd -k 2>&1 >/dev/null
         sudo -H dhcpcd
ST=$( ping -c 5 8.8.8.8|tail -2 )
if [ $ST !='connect: Network is unreachable' ]; then
CONNECT=CONNECT+1
fi
done

The ST variable doesn't capture the search string the if statement is 
needing to find.  Putting parentheses around a command appears only to 
capture output of a command and send it to stdout or stderr.  In case of 
bad network connections this script first kills dhcp then reconnects.  If 
successful it need only happen once.

  --
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.