On Sat, Jan 27, 2001 at 01:27:36PM -0800, Brad Doster <[EMAIL PROTECTED]> wrote:
| Is there a known host address that you can only ping thru the ppp interface?
| If so, you might script a ping test, then let X act based on the result
| code.  Something like this might work:
| 
|       #Wait for 4 'echo reply's or 10 seconds, whichever is greater
|       #NOTE: -w does not work under kernel 2.2.12-20 (RH 6.1).
|       #      It does work under kernel 2.2.16-22 (RH 7.0) and under
|       #      kernel 2.2.16-3 (RH 6.2), or maybe its the ping version?
|       ping -c 4 -w 10 $dest
|       rc=$?
|       if [ $rc = 0 ]; then
|               ... success ...
|       else
|               ... failure ...
|       fi

While on scripting issues, a tip: if statements (nd while etc) take a command
list as argument. You're not restricted to [ ... ] (which looks like a syntax
thing for testing stuff, deliberately so, but is simply a command in the general
sense). So you can write the above as:

        if ping -c 4 -w 10 $dest; then
                ...
        else
                ...
        fi

which reads much more intuitively to my eyes.
I'm also fond of the

        while echo -n "prompt> "
              read answer
        do
                ...
        done

style, too.
-- 
Cameron Simpson, DoD#743        [EMAIL PROTECTED]    http://www.zip.com.au/~cs/

You need a brain the size of a melon to take it [the Isle of Man TT course]
all in and one the size of a walnut to actually race it.        - Peter Salmon



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to