Bourne Shell (/bin/sh) counting?

Randal Schwartz merlyn at iwarp.intel.com
Tue Mar 20 03:36:23 AEST 1990


In article <22788 at adm.BRL.MIL>, rbottin at atl (Richard John Botting) writes:
| I'd like to see a neat solution (other than a "increment.c" program).

If you insist on doing the main looping in sh,

for i in `perl -e '@a=1..20;print"@a";'`
do
	echo $i
done

If you want to just launch stuff quickly,

perl -e 'for $i (1..20) {system "echo $i";}'

Look ma.  No C!

Just another Perl hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/



More information about the Comp.unix.questions mailing list