From 3b96a557e2bc02ab74538c42af6d41f085139862 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 26 Oct 2016 12:14:11 +0200 Subject: [PATCH] CONFIG: remove non-POSIX use of 'type' (issue #176) - In the foundation version they introduced a construct to handle the transition from 'wmRefresh' as an alias to 'wmRefresh' as a shell function. This transition is unnecessary for OpenFOAM+ since 1606 used wmREFRESH (not wmRefresh) as an alias. For portability it is important to avoid this non-POSIX "type -t". It causes issues with dash and with zsh (mentioned in issue #277). type -t dash -> -t: not found type -t zsh -> zsh: bad option: -t Note: zsh users may still noticed other problems. For example, the POSIX 'unset -f' normally has no output, but in zsh it reports an error and has exit code 1 if the function was not previously defined. Whereas in POSIX (including bash, dash) it only returns non-zero if the name(s) could not be unset. --- etc/config.sh/aliases | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/etc/config.sh/aliases b/etc/config.sh/aliases index 4fa36c11c9..43226ac483 100644 --- a/etc/config.sh/aliases +++ b/etc/config.sh/aliases @@ -69,8 +69,7 @@ alias run='cd $FOAM_RUN' # Refresh the environment # ~~~~~~~~~~~~~~~~~~~~~~~ -# For backward-compatibility unalias wmRefresh if it is defined as an alias -[ "$(type -t wmRefresh)" = "alias" ] && unalias wmRefresh || unset -f wmRefresh +unset -f wmRefresh wmRefresh() { wmProjectDir=$WM_PROJECT_DIR