🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #1150

Re: questions re bash-1.04

#1150
From: Bill Trost,Box 607,ext 640,
Date: Wed, 07 Feb 1990 01:00
24 lines
1110 bytes
In message <1510@ursa-major.SPDCC.COM>, lj@ursa-major.spdcc.COM (Len
Jacobs) writes:
....
>Is there a bash equivalent to the csh "repeat" command?

Excluding oddities in the behavior of csh (involving redirecting, job
control, and the like), this should do the job.  I've found the
oddities of csh to be non-intuitive anyhow.

Awk doesn't seem right for this, but I'm being lazy and it was the
only thing I could think of that is commonly available.  A calculator
program should do the job; a C program would be easy enough (and
useful in its own right).

repeat () {
	local count
	count=$1
	shift
	for i in `awk 'BEGIN { for (i = 1; i <= '$count'; i++)
			 print i }' < /dev/null`
	do
		$*		# use "$@" in bash 1.05 and later	
	done
}
Technical Details
Message-ID: <14088@reed.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!uunet!bu.edu!bu-cs!snorkelwacker!mintaka!ogicse!reed!trost
References: <1510@ursa-major.SPDCC.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!uunet!bu.edu!bu-cs!snorkelwacker!mintaka!ogicse!reed!trost
From: trost@reed.bitnet (Bill Trost,Box 607,ext 640,)
Newsgroups: gnu.bash.bug
Subject: Re: questions re bash-1.04
Message-ID: <14088@reed.UUCP>
Date: 7 Feb 90 01:00:44 GMT
References: <1510@ursa-major.SPDCC.COM>
Sender: news@reed.UUCP
Lines: 24