Rave Yoda
Rave Yoda

Reputation: 13

Bash Switch Statement and Executing Multiple Programs

I'm trying to use a Bash switch statement to execute a set of programs. The programs are run through the terminal via a script. The simple idea is ::

In the terminal : ./shell.sh
Program asks : "What number?"
I input : 1

Program processes as:

prog="1"
case $prog in
1) exec gimp && exec mirage ;;
esac

I've tried it several ways yet nothing will run the second program and free the terminal. The first program runs fine and frees the terminal after closing. What am I to put after executing the first program that will allow the second to run in tandem with the first and also free the terminal?

Upvotes: 0

Views: 270

Answers (1)

that other guy
that other guy

Reputation: 123410

To run two commands in the background, use & after each of them:

case $prog in 
    1)  
        gimp &
        mirage &
        ;;
esac

exec basically means "start running this program instead of continuing with this script"

Upvotes: 1

Related Questions