On Wed, 12 May 1999, Robert Johannes wrote:
>What is the syntax for using the shell command "while" ?

    while some-command-line
    do
       ...
    done

The body of the while command will execute as long as some-command-line
terminates with an exit status of 0. The system provides the commands "true"
and "false", which enables you to set a variable to either of these strings and
then use that variable as the operand to while (or if).

A shorthand notation for invoking the test command is supported, e.g.:

    while [ some-expression ]
    do
       ...
    done

This is identical to:

    while test some-expression 
    do
       ...
    done

Do "man 1 test" to see a complete explanation of the kinds of expressions which
you can specify.

>I tried the code below, but it says "ppp0=ppp0: command not found"
>
>x=ppp0
>
>while $x=ppp0
>do "echo ppp is up"
>done
>
>How would I use while in the above code so as no to produce "ppp0=ppp0:
>command not found" ??

while [ "$x" = "ppp0" ]

-- 
Dave Mielke           | 856 Grenon Avenue | I believe that the Bible is the
Phone: 1-613-726-0014 | Ottawa, Ontario   | Word of God. Please contact me
EMail: [EMAIL PROTECTED] | Canada  K2B 6G3   | if you're concerned about Hell.
  • whil Robert Johannes
    • Dave Mielke

Reply via email to