[clug] Rosetta code: bash/bourne shell 'loops' example

steve jenkin sjenkin at canb.auug.org.au
Mon Mar 22 05:10:47 MDT 2010


Kevin Pulo wrote on 22/03/10 9:34 PM:

> 
> Or O(n), considering there's a fork in the loop.
> 
> Have I missed something?  What's wrong with the ultra-simple:
> 
> n=5; s=""; while [ ${#s} -lt $n ]; do s="$s*"; echo "$s"; done
> 
> ???

Better again. Thanks!

In bash [[ ]] doesn't fork.

> 
> Kev.


More information about the linux mailing list