mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
CONFIG: address differences between shells
- suppress error messages that appear with zsh. According to unset(1p), 'unset -f' unsets a function. If the function was not previously defined, this is a no-op. This is similar for zsh, but there it emits a warning if the function was not previously defined. - avoid 'local' in functions sources from etc/bashrc. ksh does not support this. - use 'command' shell builtin instead of 'type'. Seems to be more consistent between shell flavours.
This commit is contained in:
@ -56,15 +56,13 @@ then
|
||||
}
|
||||
|
||||
# Source an etc file, possibly with some verbosity
|
||||
_foamEtc()
|
||||
{
|
||||
local file
|
||||
if [ $# -gt 0 ] && file=$($WM_PROJECT_DIR/bin/foamEtcFile "$@")
|
||||
then
|
||||
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Using: $file" 1>&2
|
||||
. $file
|
||||
fi
|
||||
}
|
||||
# - use eval to avoid intermediate variables (ksh doesn't have 'local')
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
_foamEtc(){ eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh-verbose $@)"; }
|
||||
else
|
||||
_foamEtc(){ eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh $@)"; }
|
||||
fi
|
||||
|
||||
# Evaluate command-line parameters
|
||||
_foamEval()
|
||||
@ -104,9 +102,9 @@ then
|
||||
else
|
||||
# Was previously loaded/defined - now unset
|
||||
|
||||
unset -f _foamAddPath _foamAddLib _foamAddMan 2>/dev/null
|
||||
unset -f _foamEtc _foamEval 2>/dev/null
|
||||
unset WM_SHELL_FUNCTIONS
|
||||
unset -f _foamAddPath _foamAddLib _foamAddMan
|
||||
unset -f _foamEtc _foamEval
|
||||
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user