这是我写的代码
#! /bin/bash
getopts master $1
while getopts ":master" opt; do
case $opt in
master)
echo "-master was triggered! $1 was entered" >&2
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
这是我得到的输出-
]$ ./test123.sh -master 123
./test123.sh: line 3: getopts: `-master': not a valid identifier
如何定义用户定义的选项?