Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!bu.edu!mirror!kiyun From: kiyun@mirror.tmc.com (KiYun Roe) Newsgroups: comp.unix.shell Subject: Re: for loops Message-ID: <54239@mirror.tmc.com> Date: 8 Apr 91 16:24:25 GMT References: <3693@ux.acs.umn.edu> <1991Apr3.213023.23397@athena.mit.edu> <27850:Apr700:08:2591@kramden.acf.nyu.edu> Reply-To: kiyun@mirror.UUCP (KiYun Roe) Organization: Mirror Systems. Cambridge, Mass. Lines: 17 In article <27850:Apr700:08:2591@kramden.acf.nyu.edu> brnstnd@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@mirror.TMC.COM Mirror Systems 2067 Massachusetts Avenue Cambridge, MA 02140 Telephone: 617-661-0777