I have a script which is running some of (more than 15) applications like:

cd mypath
sleep 1
gnome-terminal -t App1 --tab -e "./App1" 
sleep 1
gnome-terminal -t App2 --tab -e "./App2" 
sleep 1
gnome-terminal -t App15 --tab -e "./App15"  

As you can notice this will start apps in 15 different terminals.

Now what happens is when I kill any ./AppX by Ctrl+C, for any reason, it terminates the program as well as exits that terminal.

What I want is when I press Ctrl+C it should only terminates the ./AppX, but terminal still remain open, that is beacause when I want to start that AppX again I should press only Up Arrow key and Enter.

Got the Answer :: see the accepted answer from askubuntu.com.

Another question is : How do I execute more than one command like following:

gnome-terminal -e "sleep 1; AppX"  

which is NOT working, I tried various other methods (&, &&, |) but all failed.

  • No, its still terminating the terminal, when I press Ctrl+C. – TPS Jun 28 '14 at 6:35
  • Do you want to execute each command in different tab? or more than one command in single tab? – Pandya Dec 21 '15 at 10:54
  • each command in different tab – TPS Dec 21 '15 at 11:01

The following command will open new terminal with 15 tabs in multi-gnome-terminal:

cd mypath
multi-gnome-terminal \
  --add-tab -tname App1 --tcommand "./App1" \
  --add-tab -tname App2 --tcommand "./App2" \
  --add-tab -tname App15 --tcommand "./App15" \

If you really need those sleeps, you can incorporate them:

cd mypath
multi-gnome-terminal \
  --add-tab -tname App1 --tcommand "sleep 1; ./App1" \
  --add-tab -tname App2 --tcommand "sleep 2; ./App2" \
  --add-tab -tname App15 --tcommand "sleep 15; ./App15" \

And if you need to dynamically change count/list of commands you are about to launch, you can use the following:

cd mypath
cmd=("${cmd[@]}" --add-tab -tname App1 --tcommand "sleep 1; ./App1")
cmd=("${cmd[@]}" --add-tab -tname App2 --tcommand "sleep 2; ./App2")
cmd=("${cmd[@]}" --add-tab -tname App15 --tcommand "sleep 15; ./App15")
| improve this answer | |
  • thanks, but it's not working as per my requirements. – TPS Jul 4 '14 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.