脚本地址 https://github.com/anliven/L-Shell/tree/master/Shell-Basics 示例脚本及注释 #!/bin/bash var=$1 # 将脚本的第一个参数赋值给变量var if test $var # test - check file types and compare values then if [ $var == "right" ];then # "[]"是调用test命令的一种形式,"[]&qu…
脚本地址 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…