On Tue, Dec 20, 2016 at 5:49 PM, Jason McIntyre <j...@kerhand.co.uk> wrote:
> On Tue, Dec 20, 2016 at 10:58:40PM +0100, Michal Mazurek wrote: > > While there is nothing wrong with "while true", "while :" is better > > and used a lot more often in the source tree. > > > > OK? > > > > i'm not sure why "while :" is better in this example, but "while true" > is clearer, i think. allowing for differences in preference, is their a > good reason to change what's there? > > jmc > > > Index: bin/sleep/sleep.1 > > =================================================================== > > RCS file: /cvs/src/bin/sleep/sleep.1,v > > retrieving revision 1.22 > > diff -u -p -r1.22 sleep.1 > > --- bin/sleep/sleep.1 16 Aug 2016 18:51:25 -0000 1.22 > > +++ bin/sleep/sleep.1 20 Dec 2016 21:46:07 -0000 > > @@ -94,7 +94,7 @@ job. > > .Pp > > To monitor the growth of a file without consuming too many resources: > > .Bd -literal -offset indent > > -while true; do > > +while :; do > > ls -l file > > sleep 5 > > done > > > > -- > > Michal Mazurek > > > > Thanks, i did not know a ksh nop was a thing. I tend to agree with jmc, void* p = NULL; if (p) is neat but not clear like , if ( p != NULL ) as jw013 said: I agree. true for a condition, : for a NOP. – jw013 * * http://unix.stackexchange.com/questions/37473/what-is-the-utility-of-the-command-in-shell-scripting-given-that-it-explicitl -- --------------------------------------------------------------------------------------------------------------------- () ascii ribbon campaign - against html e-mail /\