File: repeat

package info (click to toggle)
ircii 20060725-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 5,648 kB
  • ctags: 3,794
  • sloc: ansic: 44,334; makefile: 1,091; sh: 524; perl: 127
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-
	}
}