For loop for osx:
For loop form 1 down to 4.
$ for xx in {1..4}; do echo "Hello world $xx"; done
Hello world 1
Hello world 2
Hello world 3
Hello world 4
For loop form 101 down to 95.
$ for xx in {101..95}; do echo "Hello world $xx"; done
Hello world 101
Hello world 100
Hello world 99
Hello world 98
Hello world 97
Hello world 96
Hello world 95
For with steps
$ for((i=1;i<=10;i+=2)); do echo "Welcome $i times"; done
Welcome 1 times
Welcome 3 times
Welcome 5 times
Welcome 7 times
Welcome 9 times
Work with files
$ for i in *; do echo $i; done
Applications
Desktop
Documents
Downloads
with filter
$ for i in ./*.xls; do echo $i; done
./2012.02.sysgarden.xls
./2012.03.sysgarden.xls
./2012.04.sysgarden.xls
$ DO
DONE
Geen opmerkingen:
Een reactie posten