1 2 3 4 | ||
Editor: rgouveia
Time: 2011/11/16 12:15:47 GMT+1 |
||
Note: |
added: ### ksh check if variable was defined if [[ -z $1 ]]; then print "usage: $0 option1" return 1 fi MYVARIABLE=$1 ### ksh arrays set -A myarray 1 10 30 50 70 90 100 111 100 for n in "${myarray[@]}" do echo "myarray = $n" done added: http://docstore.mik.ua/orelly/unix/ksh/ch05_01.htm
for i in $(`ls -1) ; do echo $i; done # generate 01-12 numbers with jot # and use wget to get the files # if they don't exit (-nc) for i in `jot -w '%.2u' 12`; do wget -nc http://www.example.com/r/r2005$i.pdf ; done To get each line of a file into a variable iteratively do: { while read myline;do # process $myline done } < filename To catch the output of a pipeline each line at a time in a variable use: last | sort | { while read myline;do # commands done } ### ksh check if variable was defined if [[ -z $1 ]]; then print "usage: $0 option1" return 1 fi MYVARIABLE=$1 ### ksh arrays set -A myarray 1 10 30 50 70 90 100 111 100 for n in "${myarray[@]}" do echo "myarray = $n" done http://www.well.ox.ac.uk/~johnb/comp/unix/ksh.html http://docstore.mik.ua/orelly/unix/ksh/ch05_01.htm