A Simple Linux Bash Script

Asked by Julianloui on 2012-12-12

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?

Julianloui

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

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu bash Edit question
Assignee:
No assignee Edit question
Solved by:
Julianloui
Solved:
2012-12-12
Last query:
2012-12-12
Last reply:
2012-12-12

You will need to change

totem mozart.mp3
shotwell turtle.jpg

to

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.

Julianloui (julianloui) said : #2

Andrew,

Thank you very much for your great help.

Julianloui

Midnight Matt (randygaffer) said : #3

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.