Re: true/false vs zero/non zero exit status question.
- From: grocery_stocker <cdalten@xxxxxxxxx>
- Date: Mon, 6 Apr 2009 15:34:21 -0700 (PDT)
On Apr 6, 3:24 pm, pk <p...@xxxxxxxxxx> wrote:
On Tuesday 7 April 2009 00:15, Chad wrote:
On a free unix shell site, I had written the following one line bash
script in order for me to automatically rejoin their chat line program
when I timed after after being idle for so long.
while party; do touch /dev/ttypj; sleep 1; done
The condition of the while loop is the exit status of "party"; if it returns
nonzero (ie, error), the while loop is interrupted.
Anyhow, one of the powers that be on that system suggested that I re-
write the code like the following..
while true; do party; touch `tty`; done
"true" is guaranteed to return zero (ie, success); so this while loop will
never exit.
Okay, maybe I'm being a tad bit dense here, but are you saying that if
I have something like 'while true', then the loop will continue to
execute, regardless if party returns a zero or non zero exit status?
.
- Follow-Ups:
- Re: true/false vs zero/non zero exit status question.
- From: Ben Finney
- Re: true/false vs zero/non zero exit status question.
- From: pk
- Re: true/false vs zero/non zero exit status question.
- References:
- Prev by Date: Re: true/false vs zero/non zero exit status question.
- Next by Date: Re: true/false vs zero/non zero exit status question.
- Previous by thread: Re: true/false vs zero/non zero exit status question.
- Next by thread: Re: true/false vs zero/non zero exit status question.
- Index(es):
Relevant Pages
|