LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Terminal commands working in terminal but not in a script (https://www.linuxquestions.org/questions/linux-newbie-8/terminal-commands-working-in-terminal-but-not-in-a-script-823998/)

GreYFoXGTi 08-03-2010 09:33 PM

Terminal commands working in terminal but not in a script
 
Code:

cd /tw
./DDRace_Stable -f CFG_xyz_ddrace3.cfg

those 2 lines run fine if i run them in the terminal 1 by 1
but if i put them in say qwe.sh and of course make the permissions executable
they don't
DDRace_Stable doesn't find CFG_xyz_ddrace3.cfg

i also tried giving the full path for both DDRace_Stable and the CFG
Solution:
Code:

#!/bin/bash
cd /tw
while [ 1 ]
do
./DDRace_Stable -f CFG_xyz_ddrace3.cfg
done
exit 1


Laurens73 08-04-2010 09:36 AM

Perhaps you're interested in an other way of solving the problem. It is about the quotes missing in the script. Adding two double-quotes will also make your script working:

Code:

cd /tw
./DDRace_Stable "-f CFG_xyz_ddrace3.cfg"



All times are GMT -5. The time now is 10:46 AM.