站长资源脚本专栏
shell获取命令行参数示例分享
简介复制代码 代码如下:#! /bin/bashwhile getopts a:bc optdo case $opt in a) echo "aaa" echo $OPTARG b) echo "bb" c) echo "ccc" *)
复制代码 代码如下:
#! /bin/bash
while getopts a:bc opt
do
case $opt in
a)
echo "aaa"
echo $OPTARG
b)
echo "bb"
c)
echo "ccc"
*)
echo "error"
esac
done