Calling programs from different directories

I have some csh and awk scripts on path

/nethome/chrisd/HSeis/TommyCD/TommyCD-1101/Scripts

Usually I have a working directory from where I run the scripts by having a soft link to the Scripts directory
in the directory above the working one

For example from

/nethome/chrisd/HSeis/TimeDistance/TimeDistance-1101/B-rgdt0p25/A-Synt/A-jcdint

I can run a csh program using

../Scripts/prog.csh 

Now, this is where I get confused. prog.csh calls two awk programs like this

  if (($nAnomaly == 1) && ) then
      awk -v anomaly=$Anom -v zloc="$zmin/$zmax" -v dz=$dz  \
          -v cols=$cols -v maxdepth=$maxdepth               \
          -f $spath/create-anomaly-zc.awk $fref.zc > $fmod.zc
  else if ($nAnomaly == 2) then
      awk -v anomaly="$nAnom/$pAnom" -v zloc="$zmin/$ztran/$zmax"  \
          -v dz=$dz -v cols=$cols -v maxdepth=$maxdepth            \
          -f $spath/create-anomaly-zc.awk $fref.zc > $fmod.zc
  endif

  awk -v xi="$xix/$xiz" -v xf="$xfx/$xfz"  \
      -f $spath/convert-zc-cmod.awk $fmod.zc > $fmod.cmod

As you can see I have included the variable spath which I set to the full path to the awk scipt

set spath = /nethome/chrisd/HSeis/TommyCD/TommyCD-1101/Scripts

I'm not sure what would be the best way to call the two awk scripts, they are found in the same directory as the .csh file

It is not beautiful, but it works. Better is the enemy of good enough. Do you have a specific additional need?

You could use $PATH if the awk files are good executables with first line #!/bin/awk -f and the executable chmod/ls -l permissions.

http://www.unix.com/shell-programming-scripting/146732-calling-perl-script-shell-program.html\#post302464588

The .cshrc is usually in $HOME so login sees it, and scripts and data files should not be!

http://www.unix.com/shell-programming-scripting/146652-ftp-mget-exclusion-question.html\#post302464505

Apologies, but I am not sure what you mean exactly.

Can you give some example?

Any script whose interpreter can find the script with at most one extra argument, ike ksh or sed -f or awk -f, can be made into a barefoot, freestanding executable with one line and file mode bits.

Any directory in your $PATH is searched for executables by entry name.

Make your awk scripts executable, put them in a application-dedicated bin directory, put that directory in your $PATH, and just call them without the awk, -f, path.

Suppose I was doing something similar:

I type: mkdir ~/bin
and in there I put a file davidx, and in that file I have:

#!/usr/bin/awk -f

 -- awk commands --

I type: chmod u+x ~/bin/davidx
to add execut for me.

I type: PATH=$PATH:~/bin
and add that line to my: ~/.profile

Now, I can just say this in my shell script david_sh: davidx option1 option2 ...

I should put my shell script david_sh in ~/bin, too. Then, I can call it by just typing entry name david_sh when I test. If it is a ksh script, it should look like:

#!/user/bin/ksh

 . ~/.profile

 -- ksh script commands --

 davidx option1 option2 ...

 -- ksh script commands --


Your interpreter paths (/usr/bin for ksh, awk) may vary.

There's one problem. I actually go to a different machine, which can see the Scripts and working directories and run everything from there. The thing is that I cannot change stuff on them. Can't use my machine as it's too slow.