我的 Bash-Script 应该接受参数和选项。此外,参数和选项应该传递给另一个脚本。
我解决的第二部分:
for argument in "$@"; do
options $argument
done
another_script $ox $arguments
function options {
case "$1" in
-x) selection=1
-y) selection=2
-h|--help) help_message;;
-*) ox="$ox $1";;
*) arguments="$arguments $1";;
esac
}
现在我不知道如何实现一个参数“-t”,用户可以在其中指定一些文本
它应该看起来像这样:
function options {
case "$1" in
-t) user_text=[ENTERED TEXT FOR OPTION T]
-x) selection=1
-y) selection=2
-h|--help) help_message;;
-*) ox="$ox $1";;
*) arguments="$arguments $1";;
esac
}