shell 与 awk if,for,while 比较

If
If [ $1 �Cle 100 ];then echo ture;else echo false;fi
If [[ $1<=100 ]];then echo ture;else echo false;fi
Awk ‘BEGIN{test=100;if (test>90){print test;}}’
 
For:
For I in (seq 100);do echo $i;done
For ((i=1;i<=100;i++));do echo $i;done
For ((i=1;i<=100;i++));do echo $1;done
Awk ‘BEGIN{for (x=1;x<=100;x=x+1) {print x;}}’ filename
 
While:
i=1;while [ $i �Cle 5 ] do echo $i;((i= +1));done
awk ‘BEGIN{test=100;while (i<test){i++ ;print i}}’
awk ‘BEGIN{test=100;i=1;do {printf test “\t\n”;i++} while (i<test){printf “done”;}}’

你可能感兴趣的:(while,职场,for,if,休闲)