for loops

KiYun Roe kiyun at mirror.tmc.com
Tue Apr 9 02:24:25 AEST 1991


In article <27850:Apr700:08:2591 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>And let's not forget the poor man's count script:
>
>  #!/bin/sh
>  ( echo $1 ; yes | head -$2 | sed 's/y/p1+/' ) | dc

I like this!  I've been looking for a simple way to do this.  I didn't
realize that there was a command like yes.  Is it BSD, System V, or
both?  Anyway, I don't think you need to bring sed into the pipe:

  #!/bin/sh
  ( echo $1 ; yes p1+ | head -$2 ) | dc
-- 
----
KiYun Roe	kiyun at mirror.TMC.COM
Mirror Systems	2067 Massachusetts Avenue  Cambridge, MA  02140
Telephone:	617-661-0777



More information about the Comp.unix.shell mailing list