Project

General

Profile

ifdh.sh

  • Purpose: spawn ifdh commands to a separate shell so as not to pollute user environment
  • ${JSB_TMP}/ifdh.sh some_command has same effect as ifdh some_command without environmental side effects
  • one way to set up ifdh in your user environment would be the command:
    source ${JSB_TMP}/ifdh.sh log 'setting up ifdh so I can use it later'
  • as seen below, this script is affected by the environment variable $IFDH_VERSION if present
#!/bin/sh
#
which ifdh > /dev/null 2>&1
has_ifdh=$?
if [ "$has_ifdh" -ne "0" ] ; then
    unset PRODUCTS
    for setup_file in /grid/fermiapp/products/common/etc/setups.sh /fnal/ups/etc/setups.sh /cvmfs/oasis.opensciencegrid.org/fermilab/products/common/etc/setups ; do
      if [ -e "$setup_file" ] && [ "$has_ifdh" -ne "0" ]; then
         source $setup_file
         ups exist ifdhc $IFDH_VERSION
         has_ifdh=$?
         if [ "$has_ifdh" = "0" ] ; then
             setup ifdhc $IFDH_VERSION
             break
         else
            unset PRODUCTS
         fi
     fi
   done
fi
ifdh "$@"