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:
Mark Olesen
2017-04-20 11:02:54 +02:00
parent 765c430748
commit 7f01a4beda
15 changed files with 38 additions and 38 deletions

View File

@ -71,7 +71,7 @@ OPENMPI)
fi
# Could be sourced from ThirdParty with incomplete environment
if type _foamAddLib > /dev/null 2>&1
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing
then
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
@ -140,7 +140,7 @@ MPICH)
export MPI_HOME=$MPI_ARCH_PATH
# Could be sourced from ThirdParty with incomplete environment
if type _foamAddLib > /dev/null 2>&1
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing
then
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH