Bash switch 语句并执行多个程序
Bash Switch Statement and Executing Multiple Programs
我正在尝试使用 Bash switch
语句来执行一组程序。这些程序通过脚本通过终端 运行。简单的想法是 ::
In the terminal : ./shell.sh
Program asks : "What number?"
I input : 1
程序处理为:
prog="1"
case $prog in
1) exec gimp && exec mirage ;;
esac
我已经尝试了几种方法,但是 运行 第二个程序并没有释放终端。第一个程序 运行 很好,关闭后释放终端。在执行第一个允许第二个 运行 与第一个串联并释放终端的程序后,我要放什么?
到运行两个后台命令,在每个命令后使用&
:
case $prog in
1)
gimp &
mirage &
;;
esac
exec
基本上意味着 "start running this program instead of continuing with this script"
我正在尝试使用 Bash switch
语句来执行一组程序。这些程序通过脚本通过终端 运行。简单的想法是 ::
In the terminal : ./shell.sh
Program asks : "What number?"
I input : 1
程序处理为:
prog="1"
case $prog in
1) exec gimp && exec mirage ;;
esac
我已经尝试了几种方法,但是 运行 第二个程序并没有释放终端。第一个程序 运行 很好,关闭后释放终端。在执行第一个允许第二个 运行 与第一个串联并释放终端的程序后,我要放什么?
到运行两个后台命令,在每个命令后使用&
:
case $prog in
1)
gimp &
mirage &
;;
esac
exec
基本上意味着 "start running this program instead of continuing with this script"