[clug] Rosetta code: bash/bourne shell 'loops' example
steve jenkin
sjenkin at canb.auug.org.au
Sun Mar 21 03:55:06 MDT 2010
Peter Barker wrote on 21/03/10 8:01 PM:
> On Sun, 21 Mar 2010, steve jenkin wrote:
>
> I think I prefer this - what I think to be pretty idiomatic:
>
> pbarker at eccles:~$ for i in `seq 1 5`; do for j in `seq 1 $i`; do echo -n
> '*'; done; echo; done
> *
> **
> ***
> ****
> *****
> pbarker at eccles:~$
>
> Or did I miss something?
Elegant...
I wasn't aware of the 'seq' command/builtin
[hence my "yes|head|tr -d '\n' "]
The Rosetta people made a distinction between "Unix Shell" and "Unix
pipeline", which I find a little arbitrary and confusing...
Didn't look further to find how they drew the line.
I like your one-liner better :-)
>
> Yours,
--
Steve Jenkin, Info Tech, Systems and Design Specialist.
0412 786 915 (+61 412 786 915)
PO Box 48, Kippax ACT 2615, AUSTRALIA
sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin
More information about the linux
mailing list