我希望有一个外壳脚本,它将文件名作为第一个位置参数,然后是选项(./test.sh <file> [options])。然而,当我在选项前给出一个位置参数时,getopts不起作用。我有以下代码: case $opt in echo usage ;;done所以当我在一个选项之前给出一个位置参数时,它不会对这个选项做任何事情。当在选项后
我对这个领域还比较陌生,我正在运行名为"statsrandomrun.sh“的shell脚本,代码片段如下:while getopts "m:s:xh" opt; do m) sOption -$OPTARG requires an argument." >&2
工作,这是我在上面的代码片段中实现的。我的<