# This is a template for setting environment variables # in a way that can be sourced from either an sh-style # script or a csh-style script. # To use it: go to the two "EDIT THIS" marks and substitute your own # code. Then source it. # # ------------------------------------------------------------------ # First decide if we are being invoked from csh or sh. # ------------------------------------------------------------------ unset x : test $?x != 0x && goto csh # Second, set up the desired environment variables using Bourne-shell code. # *** EDIT THIS *** # Replace these two lines with your Bourne-shell code. # ------------------------------------------------------------------ # Leave the rest of this file alone -- it's the magic for csh # ------------------------------------------------------------------ # Save the environment in a csh-compatible style. # ------------------------------------------------------------------ if [ "X$UniQuENaMe_SAVE_ENV" != "X" ] ; then printenv | \ sed -e "s/'/'"'"'"'/g" -e "s/^\([^=]*\)=\(.*\)/setenv \1 '\2'/" \ > $UniQuENaMe_SAVE_ENV fi # ------------------------------------------------------------------ # The next line protects the rest of this from sh, and the rest of # the script does the csh processing. # ------------------------------------------------------------------ cat >/dev/null <<'END' csh: setenv UniQuENaMe_SAVE_ENV $HOME/.temp_env_tmp.$$ sh /Path/To/This/File # *** EDIT THIS **** # Fill in the path to # this script source $UniQuENaMe_SAVE_ENV \rm $UniQuENaMe_SAVE_ENV unsetenv UniQuENaMe_SAVE_ENV # ----------------------------- # Leave the rest of this alone. # ----------------------------- # Gobble up the 'END' echo >/dev/null \ 'END'