我正在尝试运行具有多个参数的命令。命令语法如下:
./foo -d directory -f file -v version app1 app2 app3 (this situation works)
但是,如果我把它作为参数而不是-v version
标志传递。如何让标志在具有多个参数的任一位置工作?app1,2,3
-v
-v
while getopts ":d:f:v:" OPTION
do
case $OPTION in
d ) IFS=","; directory=$OPTARG;;
f ) file=$OPTARG;;
v ) version=$OPTARG;;
* ) echo && usage;;
/? ) echo && usage;;
esac
done
shift $(( OPTIND - 1 ))
for dir in ${dirList} do
for f in ${file} ; do
echo $dir/$file
done
done
applications=$@