[plug] Bash "Processing" Script

James Devenish devenish at guild.uwa.edu.au
Fri Jun 11 14:09:19 WST 2004


In message <OOECKHEBCBMDKGKDPJLHGEFCEJAA.jturner at bsis.com.au>
on Fri, Jun 11, 2004 at 01:53:51PM +0800, Jay Turner wrote:
> while [ true ]
> do

Firstly, FYI, note that the following should be equivalent to the above:

    while [ true ]; do

(That explains the semicolon. This should be clear in the manual -- but
I'm not a Bash users so I could be wrong.)

However, there is a fundamental error in using "[ true ]". Remember, `[`
is just a programme that basically expects a bunch of parameters and
returns a result of 0 or 1. In the case of "[ true ]", the `[` programme
is actually evaluating whether the literal text "true" has non-zero
length -- that has nothing to do with the `true` command! Try
"[ false ]" -- it will 'succeed' forever!






More information about the plug mailing list