Chinaunix

标题: 如何接受用户得参数输入 [打印本页]

作者: jeams    时间: 2003-03-16 08:28
标题: 如何接受用户得参数输入
我要对用户得参数输入作出相应:

          ./test -f test.db -start 22032003

接受 -F 后面得文件TEST.DB还有 -START 后面得日期 22032003 到变量里去。
否则给出提示错误信息。
作者: muzx    时间: 2003-03-16 09:39
标题: 如何接受用户得参数输入
/etc下面有很多脚本都是这种方式运行的,可以参考参考!
作者: bzzyg    时间: 2003-03-16 09:53
标题: 如何接受用户得参数输入
例:
if [$# -lt 4]
     then
             echo "use error!!"
             exit 1;
fi
filename=$2
dat=$4




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2