Re: How to write a condition in Bourne shell
while [ $? -ne 0 -a $retry -gt 0 ] do ... done should do the work Am Montag 05 November 2007 07:03 schrieb Olivier Nicole: > 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? > > TIA, > > Olivier > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "[EMAIL PROTECTED]" pgprwqoiKJ4BN.pgp Description: PGP signature
Re: How to write a condition in Bourne shell
On 2007-11-05 14:03, Olivier Nicole <[EMAIL PROTECTED]> 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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
How to write a condition in Bourne shell
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? TIA, Olivier ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"