Bash scripting problem
Here's the scenario:
In my /home/ATS/Build_4_1 directory I have a bash script that sets up some mission variables (I'm a NASA developer). In the /home/ATS/Build_4_1/build/rad750 directory I have a bash script that does a make clean/make all/make install for the flight software. There is also a script in the /opt/WindRiver directory that sets some environment variables. Running each script with source works just fine. What I need to do is to be able to run a single script that will call each of these three scripts which obviously have to be sourced to persist the variables. I've tried a script that looks like this:
cd /opt/WindRiver;<run script>
cd /home/ATS/Build_4_1;source <script>
cd /home/ATS/Build_4_1/build/rad750;source <script>
For some reason it doesn't get past the first call. Any Ideas?
How are you trying to run the first script? CDing each time is an unecessary step, you could run each script from one location, although the time savings would be minimal.
Edit: The first one is executable, yes?
When debugging bash scripts, I use this at the top of the script:
That will produce a script trace in /tmp/outfile<pid of process>. I'd do it in the wrapper first, to see if it's getting to the second script at all, then proceed to the other scripts to see if I could spot where the bailout happens.
Thanks for the replies. I tried as you suggested:
with the following output:
line 3: ./home/ATS/gpm_gcc_3_4_4_env.sh: no such file or directory
The same output for the other two lines of the script. Am I missing something here?
Originally Posted by ozziehome
You didn't provided the absolute path .....
check whether file exist's there
He means that the leading "." is turning your absolute paths into relative ones. Kurtdriver may have intended that there be a space after the dot, which amounts to sourcing each script using its absolute path.