File: repeat

package info (click to toggle)
ircii 20240918-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,564 kB
  • sloc: ansic: 41,234; makefile: 853; sh: 524; perl: 348
file content (22 lines) | stat: -rw-r--r-- 354 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#	$eterna: repeat,v 1.2 2001/08/12 15:57:12 mrg Exp $
#
# Use a simply while loop to repeat a command.
alias repeat {
	@ rep.cnt = [$0]
	while ( rep.cnt > 0 )
	{
		$1-
		@rep.cnt = rep.cnt - 1
	}
	^assign -rep.cnt
}

# Do the samn thing with recursion  See.. SET MAX_RECURSIONS
alias recrepeat {
	if ([$0] > 0)
	{
		$1-
		recrepeat ${[$0] -1} $1-
	}
}