一、参数
$1 $2 $3,依次为第一个参数第二个参数,第三个参数 $@ 参数列表
二、for 循环
#数值变遍历 #!/bin/bash for((i=1;i<=10;i++)); do echo $i; done #!/bin/bash for i in {1..10} do echo $i done awk ‘BEGIN{for(i=1; i<=10; i++) print i}‘
#列表遍历 #!/bin/bash list="aa bb cc dd" for i in $list; do echo $i is appoint ; done
# 命令结果遍历 $() ‘‘ 写执行命令
#!/bin/bash for i in `ls`; do echo $i is file name\! ; done #!/bin/bash for file in $(ls *.sh) do echo $file is file path \! ; done