We believe that writing is about content, about what you want to say – not about fancy formatting.
我们坚信写作写的是内容,所思所想,而不是花样格式。
— Ulysses for Mac
直接看图
第一种 for :
for NAME [in WORDS ... ] ; do COMMANDS; done
例如:
for a in 1 2 3 4 ; do echo $a ; done
for a in 1 2 3 ; do echo $a > ${a}.txt ; done
for a in 1 2 3 ; do rm ${a}.txt ; done
if + for shell 编程
#!/bin/bash
if [[ $# -lt 1 ]] ; then echo no param !!! ; exit ; fi
for a in "$@" ; do echo $a > ${a} ; done
for 语法二:
for (( exp1; exp2; exp3 )); do COMMANDS; done
例:
for (( a = 1 ; a < 11 ; a = a + 1 )) ; do echo $a ; done
help while
$# 是取得参数的个数
$1 是取第一个参数
世界上所有的追求都是因为热爱
一枚爱编码 爱生活 爱分享的IT信徒
—— hongXkeX