Example LIGOtools Setup Scripts

Peter Shawhan

Version 1.3 of the ltadmin package (released March 28, 2001) introduced a script called use_ligotools which robustly sets the LIGOTOOLS environment variable and modifies PATH, etc. This works with all popular shells and is now the preferred mechanism to set up environment variables. However, it was previously necessary to create a setup script for each cluster, and these may still be in use. Here are some examples.

At Caltech, the setup script is called ligotools_setup and looks like this:

set ligotools = /ligoapps/ligotools

if ( -d $ligotools/bin ) then
   setenv LIGOTOOLS $ligotools
   setenv PATH ${PATH}:${LIGOTOOLS}/bin
   setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${LIGOTOOLS}/lib
   if ( $?MATLABPATH ) then
      setenv MATLABPATH ${MATLABPATH}:${LIGOTOOLS}/matlab
   else
      setenv MATLABPATH ${LIGOTOOLS}/matlab
   endif
endif
One executes this script by doing source ligotools_setup. (At Caltech, this is done automatically.)

At Hanford, the setup script is /export/apps4/ligotools/setup and is a bit fancier:

set __ligotools = /export/apps4/ligotools
set __bindir = /export/apps4/bin
set __libdir = $__ligotools/lib
set __matlabdir = $__ligotools/matlab

if ( -d $__bindir ) then
    setenv LIGOTOOLS $__ligotools

    ##- Add to the PATH, but only if not already there.
    set d = $__bindir
    if ( `echo $PATH | grep -c -e ":${d}:" -e "^${d}:" -e ":${d}"'$'` == 0 ) then
        setenv PATH ${PATH}:$__bindir
    endif

    ##- Add to the LD_LIBRARY_PATH, but only if not already there.
    set d = $__libdir
    if ( `echo $LD_LIBRARY_PATH | grep -c -e ":${d}:" -e "^${d}:" -e ":${d}"'$'` == 0 ) then
        setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$__libdir
    endif

    ##- Add to the Matlab path, but only if not already there
    set d = $__matlabdir
    if ( $?MATLABPATH ) then
        if ( `echo $MATLABPATH | grep -c -e ":${d}:" -e "^${d}:" -e ":${d}"'$' -e "^${d}"'$'` == 0 ) then

            setenv MATLABPATH ${MATLABPATH}:$__matlabdir
        endif
    else
        setenv MATLABPATH $__matlabdir
    endif

endif

unset __ligotools
unset __bindir
unset __libdir
unset __matlabdir
This script is not run automatically at LHO.