有没有办法让下面的bash脚本在之前显示它的选择菜单而不是之后的两个提示 ?有没有在这个Bash脚本菜单中显示提示的方法?
谢谢。
#!/usr/bin/env bash
PS3='Copy database to which server? '
options=("debug" "dev" "prod" "Quit")
select server in "${options[@]}"
do
case $server in
"debug")
break
;;
"dev")
break
;;
"prod")
break
;;
"Quit")
echo "Quitting"
exit 1
;;
*) echo "Invalid option";;
esac
done
PS3='Reuse existing user data or get fresh data? '
options=("existing" "fresh" "Quit")
select data in "${options[@]}"
do
case $data in
"existing")
break
;;
"fresh")
break
;;
"Quit")
echo "Quitting"
exit 1
;;
*) echo "Invalid option";;
esac
done
echo "You chose "$server" and "$data
exit 1
只是改变'PS3 =''到回声'?祝你好运。 – shellter