Re: sleep.1: "while true;" -> "while :;"
On 2016-12-20, Jason McIntyrewrote: > 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? I agree that "true" is clearer and I see no reason to change this. -- Christian "naddy" Weisgerber na...@mips.inka.de
Re: sleep.1: "while true;" -> "while :;"
On Wed, Dec 21, 2016 at 09:59:18AM +0100, Michal Mazurek wrote: > On 22:49:38, 20.12.16, Jason McIntyre 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? > > ":" is a builtin, and appears to be the proper idiom as evidenced by the > source tree: > > $ grep -r 'while true' . | wc -l > 11 > > $ grep -r 'while :' . | wc -l > 156 > morning. "true" is also a built-in. the only difference i can see really is that ":" is classed as a special built-in, but in the sleep example i don;t see that being relevant. it is maybe not used so much in the tree but it is correct. i still don;t see the point of the change. jmc
Re: sleep.1: "while true;" -> "while :;"
On 22:49:38, 20.12.16, Jason McIntyre 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? ":" is a builtin, and appears to be the proper idiom as evidenced by the source tree: $ grep -r 'while true' . | wc -l 11 $ grep -r 'while :' . | wc -l 156 -- Michal Mazurek
Re: sleep.1: "while true;" -> "while :;"
On Tue, Dec 20, 2016 at 5:49 PM, Jason McIntyrewrote: > 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 - 1.22 > > +++ bin/sleep/sleep.1 20 Dec 2016 21:46:07 - > > @@ -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 /\
Re: sleep.1: "while true;" -> "while :;"
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 - 1.22 > +++ bin/sleep/sleep.1 20 Dec 2016 21:46:07 - > @@ -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 >
sleep.1: "while true;" -> "while :;"
While there is nothing wrong with "while true", "while :" is better and used a lot more often in the source tree. OK? 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 - 1.22 +++ bin/sleep/sleep.1 20 Dec 2016 21:46:07 - @@ -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