Date: Mon, 5 Nov 2007 14:01:41 +0200 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Olivier Nicole <on@cs.ait.ac.th> Cc: freebsd-questions@freebsd.org Subject: Re: How to write a condition in Bourne shell Message-ID: <20071105120140.GD2093@kobe.laptop> In-Reply-To: <200711050703.lA573V3q013117@banyan.cs.ait.ac.th> References: <200711050703.lA573V3q013117@banyan.cs.ait.ac.th>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2007-11-05 14:03, Olivier Nicole <on@cs.ait.ac.th> wrote: > Hi, > > I am a lame Bourne sheel programmer, how to write: > > while [ ( $? -ne 0 ) -a ( $retry -gt 0 ) ] ; do > > that should execute as long as $? is not null and $retry is greater > than 0? Try something like... retry=0 done=-0 while [ $done -eq 0 ] && [ $retry -lt 10 ]; do run_some_other_stuff_here if [ $? -eq 0 ]; then done=1 fi done if [ $done -eq 0 ]; then echo "Failed after $retry attempts." fi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071105120140.GD2093>