Skip to content
Snippets Groups Projects
Commit 3b96a557 authored by Mark Olesen's avatar Mark Olesen
Browse files

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.
parent 567e1f2d
Branches
Tags
No related merge requests found
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment