for ((i = 1; i <= 5; i++)); do echo $i; doneOtherwise for i in {1..5}; do ... is a simpler syntax that works in newer bash versions. More details can be seen at Vivek Gite's Bash For Loop Examples.
Saturday, November 21, 2009
Bash 2.0 For Loop Counter
This is the syntax you can use for a simple for loop counter in bash version 2 (e.g. on Apple OS X version 10.4):
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment