Closed BrushXue closed 3 years ago
Sorry I didn't notice there is a similar issue #56. So it seems like there's no solution to support both shells. Maybe I'll just keep this for my personal use. Switching to zsh or a newer bash from homebrew, which one is better?
Work-around could be to detect if paraview
file is sourced under zsh
and this could be achieved with:
if [ -n "$ZSH_VERSION" ]
then
# ZSH does not have -f flag
export paraview
else
export -f paraview
fi
Yet, this work-around will not export function to sub-shells, so certain functionality will be broken (ex. running paraview
from scripts). But it will remove annoying function output.
Answering your second question: it depends on the definition of better. For my use-cases old bash is good enough, so it is better, because I do not need to change anything. Guess, there are people, who prefer tcsh
. For someone zsh
is better.
The worst part of the outdated bash is auto completion. I would prefer updating bash to have best compatibility with Linux, only if Apple allows us to touch /bin/bash.🙃
Now
zsh
is the default shell in macOS. And the original OpenFOAMconfig.sh
should be zsh compatible, as documented in https://develop.openfoam.com/Development/openfoam/-/blob/master/bin/foamSystemCheck#L115 In your v2012 patch(also applies to previous patches), regarding the fileetc/config.sh/mac/paraview
zsh doesn't support
export -f
. It will only print the function to the terminal.What I'm doing right now is commenting out these lines, and adding them to the beginning of
bin/paraFoam
withoutexport -f
. This temporary fix is really ugly. Do you have any better idea to implement a universal script that works on both shells? Thanks.