Reputation: 1
I have a bash script with a lot of lines using the command gnome-terminal so it can open several terminals an execute programs. The problem is that some of the programs depend of the executing of one in particular that takes some time, so I need to be sure that this line stop running before the bash can continue with the next.
One way to do it is to put a wait time with "sleep", calculating how much time this program needs to run for completed; but someone know a more efficient way?
Thank you.
Upvotes: 0
Views: 101
Reputation: 189427
Instead of
xterm -e program1 &
xterm -e program2 &
use
program1
program2
or if you absolutely need them to run in an xterm,
xterm -e sh -c 'program1; program2'
The more sane solution is to factor out the xterms from the actual script and do
xterm -e path/to/yourscript &
when you want your script to run in an xterm.
Upvotes: 1