Getting correct path to run appropriate script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Getting correct path to run appropriate script
# 1  
Old 01-16-2012
Getting correct path to run appropriate script

I have tcsh scripts on path
Code:
/home/chrisd/tatsh/trunk/hstmy/bin/tcsh/

I want to run the script from within another script.

Suppose I go to directory
Code:
/home/chrisd/tatsh/trunk/hsdata/n02/terr0.25/darwin

and want to run checksrdist.tcsh


So I do

Code:
cd  /home/chrisd/tatsh/trunk/hsdata/n02/terr0.25/darwin
/home/chrisd/tatsh/trunk/hstmy/bin/tcsh/checksrdist.tcsh


Inside checksrdist.tcsh I do
Code:
set pthcsh = `echo $0:h`

Of course this gets good result when I do
Code:
$pthcsh/printTable.tcsh

If I do as below it is ok
Code:
cd /home/chrisd/tatsh/trunk/hstmy/bin/tcsh/
./checksrdist.tcsh

but if I do like this, it fails when calling $pthcsh/printTable.tcsh inside checksrdist.tcsh
Code:
cd /home/chrisd/tatsh/trunk/hstmy/bin/tcsh/
checksrdist.tcsh

# 2  
Old 01-17-2012
you can run your script in debug mode to see the exact path...

Code:
 
csh -x my_commands

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need output of script on screen and file with correct return status of the called script.

Hi, I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed. Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies

2. Solaris

run a service via startup script (correct me if I am wrong)

Environment Solaris 9 I have configured the Solaris9 as NTP client in which Solaris9 is syncing the time with a windows2008 R2 Server which is runing fine. Now I want that the xntpd service should start at startup. I did this via a script. Kindly correct if I did any thing wrong: 1.)Made... (9 Replies)
Discussion started by: z_haseeb
9 Replies

3. Shell Programming and Scripting

Script working when run manually but not in crontab showing path not found

i have a script running using variable defined in .profile when i run that script manually its working but when i run the same script through cron its giving path not found I had defined path in .profile (3 Replies)
Discussion started by: raj_saini20
3 Replies

4. Shell Programming and Scripting

Please Correct My script

############### #filename.sh ############### CUREENT_DATE=02 log_file_path="$CUREENT_DATE"-"${0##%*/}`|cut -d "." -f1|awk -F "/" '{print $NF}'`"".log" echo $log_file_path ################ #output required 02-filename.log (6 Replies)
Discussion started by: mohitmehral
6 Replies

5. Shell Programming and Scripting

absolute path for a script ran with relative path

I have a script in which i want to print absolute path of the same script irrespective of path from where i run script. I am using test.sh: echo "pwd : `pwd`" echo "script name: $0" echo "dirname: `dirname $0`" when i run script from /my/test/dir/struct as ../test.sh the output i... (10 Replies)
Discussion started by: rss67
10 Replies

6. Shell Programming and Scripting

Question on tweaking the PATH variable to allow the world to run my executable script

All, I am pretty new to Unix and still in the learning curve :) I have a simple requirement for which I did not get an answer yet (Atleast I do not know how to keyword the search for my requirement!!!). I have an executable script my.script1 in a folder /data/misc/scripts/dev, which when... (5 Replies)
Discussion started by: bharath.gct
5 Replies

7. Shell Programming and Scripting

Making a KSH exit if path is not correct

I am very green to shell programming and have no training and this is my first real attempt. I am fairly versed in Unix and running the cmds I need. I tried using the search feature but most of what I found was close but not quite what I am looking for, plus most looked more advanced than I... (7 Replies)
Discussion started by: htown71
7 Replies

8. UNIX for Dummies Questions & Answers

Cannot retreive correct $PATH using PLINK

Hi, I'm using plink to execute shell script on UNIX machines. It works pretty well excepted with some machines where I don't have the same $PATH than with putty. I'm using the command PLINK.EXE -ssh machinename -l user -pw password echo $PATHAnd for putty nothing special set, I use ssh as... (2 Replies)
Discussion started by: Peuj
2 Replies

9. Solaris

Correct me to run a sh file in ksh shell!

Hi all! I wrote a file named as rman_backup.sh, and this is contents #!/bin/ksh ORACLE_SID=VNP;export ORACLE_SID echo $ORACLE_SID echo "Please Specify the kind of backup you want to take" echo "1) LEVEL 0 VNP" echo "2) LEVEL 1 VNP" echo "3) EXPORT BACKUP" echo "Enter your option" ... (4 Replies)
Discussion started by: trantuananh24hg
4 Replies
Login or Register to Ask a Question