On Thu, 2002-09-05 at 15:04, Smitty wrote:
> What would the syntax be if I wanted to repeat a command n times?
> And if after repeating the command n times, follow it by another command?
> Smitty
Or, more appropriately:
#!/bin/sh
LIMIT=10
for((n=1; n <= LIMIT ; n++)) ; do
command
done
anothercommand
Or even:
#!/bin/sh
LIMIT=10
((n = 0))
while (( n <= LIMIT )); do
echo n=$n
((n += 1))
command
done
anothercommand
Yes, you actually can use C-like syntax within double-parenthesis.
- Ian
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:57:14 EDT