Results 1 to 8 of 8
Hi,
I was making a bash script to do open three programs in one click. I've gotten the variables all done but I can't get it to work. When I ...
- 05-06-2008 #1Just Joined!
- Join Date
- Apr 2008
- Posts
- 30
BASH variable help!
Hi,
I was making a bash script to do open three programs in one click. I've gotten the variables all done but I can't get it to work. When I run the bash script it won't open the second program until the first one is closed. How do I get it to open the 1st one, then the 2nd, and then the 3rd right after each other?
- 05-06-2008 #2
It would be helpful to see the script, but perhaps you need to use the ampersand (&) character?
This will "background" each of the programs and should stop the shell waiting for them to return a value before proceeding to the next program.Code:program1 & program2 & program3 &
Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode
- 05-06-2008 #3Just Joined!
- Join Date
- Apr 2008
- Posts
- 30
- 05-06-2008 #4
Try this,
The ampersands after each of the commands will background the processes as I mentioned in my previous post. Let us know if it works.Code:#!/bin/bash JACK="jackd -d alsa is &" QSYNTH="qsynth &" ROSEGARDEN="rosegarden &" $JACK $QSYNTH $ROSEGARDEN
Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode
- 05-07-2008 #5Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
smolloy solved the problem, but, might I ask why are you using variables there?
I can't see a purpose behind it if all you are doing is declaring them just to launch the command three lines below.
- 05-07-2008 #6Just Joined!
- Join Date
- Apr 2008
- Posts
- 30
Ok thanks. It worked with the &. Now I just have one more question. How do I run the script from terminal? I just wanna be able to type something in the terminal command line and then it do what the script says. THANKS!!!
- 05-07-2008 #7Just Joined!
- Join Date
- Apr 2008
- Posts
- 30
Ok, nevermind about my last post. I have to drag the icon into terminal and push enter. Duh. I forgot. Ok, so thanks for all of your help you guys!!!!! You've made my day!!!!!!!!!
Bring on the dancing bananas!!!!


- 05-07-2008 #8
I didn't know that dragging an icon into a terminal worked like that! Cool!

You could also add the script to your path by moving it to /usr/local/bin, or by creating a soft link to your script in /usr/local/bin.
Or change to the directory containing your script and enter its name preceeded by ./
i.e.Code:./yourscript.sh
Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode


Reply With Quote
