We believe that writing is about content, about what you want to say – not about fancy formatting.
我们坚信写作写的是内容,所思所想,而不是花样格式。
— Ulysses for Mac
直接看图
1 2第一种 for :
for NAME [in WORDS ... ] ; do COMMANDS; done
例如:
for a in 1 2 3 4 ; do echo $a ; done
3
for a in 1 2 3 ; do echo $a > ${a}.txt ; done
4
for a in 1 2 3 ; do rm ${a}.txt ; done
5
6
7
8
9
10
11
12 13 14
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
15
help while
16 17$# 是取得参数的个数
$1 是取第一个参数
18
世界上所有的追求都是因为热爱
一枚爱编码 爱生活 爱分享的IT信徒
—— hongXkeX
网友评论