Skip to content
Snippets Groups Projects
Commit 6957c8bc authored by Brad Sawatzky's avatar Brad Sawatzky Committed by Stephen A. Wood
Browse files

Fix/clarify setup.csh behavior when called from script

- The underlying problem here is that $_ is assumed to contain the path
  to the sourced file, but that isn't true for any version of tcsh I've
  tried... (I guess it must have worked for some version of tcsh?)
  Anyway, that fails and $1 is also empty in the else clause so the
  script fails.

- Reliably finding the path to a sourced file is next to impossible in
  tcsh, so just encourage/force people to pass a path to the script
  directory as an argument.

-- Brad
parent 095a9ffa
No related branches found
No related tags found
No related merge requests found
#!/bin/csh #!/bin/tcsh
set called=($_) if ( $?loginsh ) then
if ("$called" != "") then set MYDIR=`pwd`
set scriptdir=$called[2] echo "--> Setting HCANALYZER to $MYDIR"
set MYDIR=`dirname $scriptdir`
set MYDIR=`c\d $MYDIR && pwd` # ensure absolute path
else else
set scriptdir=$1 if ( "$1" == "" ) then
set MYDIR=$scriptdir echo "ERROR: 'setup.csh' must have a path to the hcana location as its argument"
echo " Often this is also the location of the setup.csh script itself:"
echo " source /my/path/to/setup.csh /my/path/to/setup.csh"
echo " Or, if you have already cd'd into the hcana directory, then you can call:"
echo ' source setup.csh `pwd`'
exit 1
else
set MYDIR=$1
endif
endif endif
setenv ANALYZER $MYDIR/podd setenv ANALYZER $MYDIR/podd
setenv HCANALYZER $MYDIR setenv HCANALYZER $MYDIR
# Check if LD_LIBRARY_PATH is defined # Check if LD_LIBRARY_PATH is defined
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment