Results 1 to 6 of 6
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-02-2012 #1Just Joined!
- Join Date
- Mar 2012
- Posts
- 2
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:
#!/bin/bash
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?
Thanks
- 03-02-2012 #2Linux Newbie
- Join Date
- Oct 2008
- Posts
- 150
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.
How about
Edit: The first one is executable, yes?Code:#!/bin/bash -x ./opt/WindRiver/scriptname ./home/ATS/Build_4_1/scriptname ./home/ATS/Build_4_1/build/rad750/scriptname exit
Last edited by kurtdriver; 03-02-2012 at 11:37 PM.
- 03-03-2012 #3
When debugging bash scripts, I use this at the top of the script:
set -x
exec 2>/tmp/outfile$$
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.
- 03-03-2012 #4Just Joined!
- Join Date
- Mar 2012
- Posts
- 2
Thanks for the replies. I tried as you suggested:
#!/bin/bash -e
./home/ATS/gpm_gcc_3_4_4_env.sh
./home/ATS/Build_4_1/setvars.sh
./home/Build_4_1/build/rad750/build.sh
with the following output:
./home/ATS/gpm_gcc_3_4_4_env.sh
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?
Thanks
- 03-03-2012 #5Just Joined!
- Join Date
- Jan 2011
- Location
- Hyderabad, India
- Posts
- 21
- 03-03-2012 #6
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.
Code:#!/bin/bash -e . /home/ATS/gpm_gcc_3_4_4_env.sh . /home/ATS/Build_4_1/setvars.sh . /home/Build_4_1/build/rad750/build.sh


Reply With Quote

