zsh-users
 help / color / mirror / code / Atom feed
* while {some command does not exit = 1)
@ 2013-06-03  4:24 TJ Luoma
  2013-06-03  5:05 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: TJ Luoma @ 2013-06-03  4:24 UTC (permalink / raw)
  To: Zsh-Users List

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-03  5:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03  4:24 while {some command does not exit = 1) TJ Luoma
2013-06-03  5:05 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).