Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

while {some command does not exit = 1)



I keep thinking that there must be an easier way to do this, but I
can't figure out what it would be, and Google has not helped.

I'm trying to create a "while" loop which will keep going as long as
some command does not exit = 0

Here's what I have been doing:

#!/bin/zsh -f

EXIT=1

while [ "$EXIT" = "1" ]
do

	drutil discinfo | fgrep -q 'Please insert a disc to get disc info.'

	EXIT="$?"

	FOO

done

exit 0
# EOF

(where 'FOO' is some command I want to run)

What I keep thinking I ought to be able to do is something like this

while ((! drutil discinfo | fgrep -q 'Please insert a disc to get disc info.' ))
do

	FOO


done

I realize that "while (( ))" syntax is wrong, but I hope the idea is
clear. It appears that the | might be what is making this not work.

Is there an easier way to do this?

TjL



Messages sorted by: Reverse Date, Date, Thread, Author