我有一个这样的 bash 脚本:
usage="setup.sh [-localsource path to dir] [-help]";
for i in $@
do
if [ "$localSourceOpt" = 1 ]
then
localSource=$i
localSourceOpt=0;
fi
if [ "$i" = "-localsource" ]
then
localSourceOpt=1;
fi
if [ "$i" = "-help" ]
then
echo "$usage";
exit;
fi
done
这需要论据,例如
setup.sh -localsource PATH
我需要添加另一个可能具有多个参数值的参数,例如
setup.sh -localsource PATH -locbranches one two three
我应该怎么做才能捕获为参数“-locbranches”传递的值
提前致谢