作业帮 > 综合 > 作业

Linux脚本,#/bin/bash if [ $1 = cat ];then echo "dog"; elif [ $

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/04/28 16:26:38
Linux脚本,#/bin/bash if [ $1 = cat ];then echo "dog"; elif [ $1 = dog ];then
$0,其实表示的就是shell脚步文件本身的名称;
$1,表示运行shell脚步时提供的第一个参数;
$2,表示运行shell脚步时提供的第二个参数;
.
依此类推!
再问: 可以提供$0,$1,$2都存在的脚本吗,我想问的其实就是这个部分但是没说清楚,谢谢
再答: #!/bin/sh error() { echo $2 exit $1 } if [ $# -lt 4 ]; then error 1 "Invalid parameters. Usage: $0 interval(in second) endtime(time to end the sending) peer_number(peer's telephone number) SMS_context(content of SMS)" fi