I have some C++ code in the following directory structure
/home/chrisd/tatsh/trunk/hstmy/
baseLib
bin
awk
bash
diag
ksh
TAG201011
old
perl
prog
py
tcsh
docs
fortran
others
scripts
source
My directory structure of my data is
/home/chrisd/tatsh/trunk/hsdata/
docs
drw-doc
smp-doc
htest1
darwin
jcdint
npt02
npt04
npt06
npt08
npt10
npt20
npt30
npt40
npt50
test2
Tmp
J-Test
misfit
models
pdf
raytrac
A-jcdint
B-npt02
C-npt04
D-npt06
E-npt08
F-npt10
G-npt20
H-npt30
I-npt40
J-npt50
residuals
simplex
A-jcdint
B-npt02-smp
C-npt04-smp
D-npt06-smp
E-npt08-smp
F-npt10-smp
G-npt20-smp
H-npt30-smp
I-npt40-smp
J-npt50-smp
Tmp
synt
jcdint
npt02
npt04
npt06
npt08
npt10
npt20
npt30
npt40
npt50
synth
jcd
n02
n06
n10
n20
Basically I go to one of my data directories
/home/chrisd/tatsh/trunk/hsdata/htest1/raytrac/A-jcdint
by performing
cd /home/chrisd/tatsh/trunk/hsdata/htest1/raytrac/A-jcdint
and run the scripts from the data directory using
/home/chrisd/tatsh/trunk/hstmy/bin/bash/raytrac.bash data1 data2
The thing is that my bash script raytrac.bash needs to call other scripts and programs as well.
For example, from within my bash script, raytrac.bash, I would need to call
/home/chrisd/tatsh/trunk/hstmy/bin/bash/browseFiles.bash opt1 opt2
awk -v dsrmx=$dsrmx -f /home/chrisd/tatsh/trunk/hstmy/bin/awk/addTrvt.awk $f > $fout
/home/chrisd/tatsh/trunk/hstmy/bin/prog/raytrac --vmod=$cmodInfile --srfile=$srcsInfile
So I am wondering how to automatically set up the paths I need for the bash, awk and prog directories, without having to hardwire the paths. This is important as I can always run my tests on whatever machine I want without having to change the paths every time.
Basically by knowing where my data and my bash script is, the base script will take care of figuring out the directory paths for the bash, awk and prog directories.
How can I best do this in bash?