A Simple Linux Bash Script

Asked by Julianloui

How can I run two applications concurrently in my following simple script? It makes sense that Bash lets me run only the first application. How can I continue to the next command without first ending the currrent one?


#! /bin/bash
totem mozart.mp3
shotwell turtle.jpg
killall -9 totem
killall -9 shotwell

Question information

English Edit question
Ubuntu bash Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :

You will need to change

totem mozart.mp3
shotwell turtle.jpg


totem mozart.mp3 &
shotwell turtle.jpg &

This will background the process and allow the next to run straight after. Without it, the script will wait til totem is closed, then run the next process. This then also has to be closed to run the next command and so forth. as you have not specified the files absolutely, you will need to run the command whilst in the same folder as both files.

Revision history for this message
Julianloui (julianloui) said :


Thank you very much for your great help.


Revision history for this message
Midnight Matt (randygaffer) said :

Plus, if at anytime you want to move a process to the background while it's running, first hit ^Z (Control-Z), you'll then see the word `Suspended`. Then enter the letters `bg` at the prompt. You should then see the command you've just moved to the background w\ an ampersand appended.