#!/bin/sh # # $HOME/.sh/.setenv - script for environment variables. # # written by Hiroki Sato # $Id$ # usage: # # from tcsh: # if ( -f $HOME/.sh/.setenv ) then # eval `$HOME/.sh/.setenv -c` # endif # # from sh: # if [ -f $HOME/.sh/.setenv ]; then # eval `$HOME/.sh/.setenv -s` # fi ### -s for sh, -c for csh/tcsh getopts s,c OPT ### set variables for convenient BASE=$HOME/.sh CACHE_SH=$BASE/.setenv.cache.sh CACHE_CSH=$BASE/.setenv.cache.csh ### include common definitions . $BASE/.setenv.inc ### for sh or tcsh? if [ "$OPT" = "c" ]; then CACHE=$CACHE_CSH else CACHE=$CACHE_SH fi DEPENDS=`$LS -At $BASE | $HEAD -2 | $GREP '^\.setenv\.cache\.' | $WC -l`; if [ $DEPENDS -ne 2 ]; then echo ".setenv: cache file is updated." 1>&2 $CP /dev/null $CACHE_SH $CP /dev/null $CACHE_CSH create_cache; else echo ".setenv: using cache ($CACHE)." 1>&2 fi $CAT $CACHE;