etc/bashrc: removed sourcing of additional files passed as

arguments to the original sourced file. Caused an infinite loop if original source command
is called within a function, e.g.

sourceFile() {
    . $1
}
This commit is contained in:
Chris Greenshields
2021-09-07 17:10:13 +01:00
parent 19950fa3b8
commit 8830b2fa1e
3 changed files with 9 additions and 22 deletions

View File

@ -158,10 +158,10 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# Add in preset user or site preferences:
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
# Evaluate command-line parameters and record settings for later
# these can be used to set/unset values, or specify alternative pref files
# Evaluate command-line parameters of the form "param=keyword" or unset
# parameters with "param="
export FOAM_SETTINGS="$@"
_foamEval $@
_foamParams $@
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -48,7 +48,7 @@ then
}
# Evaluate command-line parameters
_foamEval()
_foamParams()
{
while [ $# -gt 0 ]
do
@ -67,15 +67,6 @@ then
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "export $1" 1>&2
eval "export $1"
;;
*)
# Filename: source it
if [ -f "$1" ]
then
_foamSource "$1"
else
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -silent "$1"`
fi
;;
esac
shift
done
@ -117,6 +108,6 @@ else
# ~~~~~~~~~~~~~~~~~~~~
unset WM_BASH_FUNCTIONS
unset _foamAddPath _foamAddLib _foamAddMan
unset _foamSource _foamEval
unset _foamSource _foamParams
fi

View File

@ -151,8 +151,8 @@ alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!*
# Add in preset user or site preferences:
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh`
# Evaluate command-line parameters and record settings for later
# these can be used to set/unset values, or specify alternative pref files
# Evaluate command-line parameters of the form "param=keyword" or unset
# parameters with "param="
setenv FOAM_SETTINGS "${*}"
while ( $#argv > 0 )
switch ($argv[1])
@ -171,12 +171,8 @@ while ( $#argv > 0 )
eval "setenv $argv[1]:s/=/ /"
breaksw
default:
# filename: source it
if ( -f "$1" ) then
_foamSource "$1"
else
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -silent "$1"`
endif
# ignore non-parameter arguments, e.g. filenames
break
breaksw
endsw
shift