Is there an easy way I can print the full path of file.txt
?
file.txt = /nfs/an/disks/jj/home/dir/file.txt
The
In a similar scenario, I'm launching a cshell script from some other location. For setting the correct absolute path of the script so that it runs in the designated directory only, I'm using the following code:
set script_dir = `pwd`/`dirname $0`
$0
stores the exact string how the script was executed.
For e.g. if the script was launched like this: $> ../../test/test.csh
,
$script_dir
will contain /home/abc/sandbox/v1/../../test