写在前面:案例.常用.归类.解释说明.(By Jim) 命令行参数$1为第一个参数,$2为第二个参数,依次类推...示例: #!/bin/bash # using one command line parameter factorial= ;number<=$;number++)) do factorial=$[ $factorial*$number ] done echo The factorial is $factorial 调用./test1 5(这样就把参数传递进去了)结果:The fa…
脚本地址 https://github.com/anliven/L-Shell/tree/master/Shell-Basics 示例脚本及注释 1 - arguments #!/bin/bash if [ -n "$1" ];then # 验证参数是否传入 echo "The first parameter is ${1}." else echo "No arguments!" fi echo '$0 当前shell脚本的名称:' $0 ech…