FDS6VARS.sh (part of the macOS release bundle under /Applications/FDS/FDS6/bin/) uses the == comparison operator inside single square brackets ([ "$PATH" == "" ]) in its if conditions. This is not POSIX-compliant syntax for the test command (only a single = is valid there). While bash silently accepts this as an extension, sourcing the script under zsh fails, because zsh tries to resolve the second = via its EQUALS expansion and cannot find a matching command.
Steps to reproduce the behavior:
- Install FDS6 on macOS (installation path:
/Applications/FDS/FDS6/)
- Use
zsh as the default shell
- Add/execute the following line in
.zprofile: source /Applications/FDS/FDS6/bin/FDS6VARS.sh
- Restart the terminal or run
source .zprofile
- The following error appears:
/Applications/FDS/FDS6/bin/FDS6VARS.sh:3: = not found
Expected behavior
The script should run without errors and correctly set the environment variables (PATH, DYLD_LIBRARY_PATH, OPAL_PREFIX, TMPDIR, OMP_NUM_THREADS), regardless of whether it is sourced with bash or zsh.
Desktop
Suggested fix for FDS6VARS.sh:
#!/bin/bash
FDSBINDIR=/Applications/FDS/FDS6/bin
if [ "$PATH" = "" ]; then
export PATH=$FDSBINDIR
else
export PATH=$FDSBINDIR:$PATH
fi
export PATH=$FDSBINDIR/openmpi/bin:$PATH
export OPAL_PREFIX=$FDSBINDIR/openmpi # used when running the bundled fds
if [ "$DYLD_LIBRARY_PATH" = "" ]; then
export DYLD_LIBRARY_PATH=$FDSBINDIR/openmpi/lib
else
export DYLD_LIBRARY_PATH=$FDSBINDIR/openmpi/lib:$DYLD_LIBRARY_PATH
fi
export TMPDIR=/tmp
export OMP_NUM_THREADS=4
Additionally, line 1 is missing the exclamation mark in the shebang (#/bin/bash instead of #!/bin/bash).
It should also be checked whether SMV6VARS.sh contains the same issue (== instead of =)
FDS6VARS.sh(part of the macOS release bundle under/Applications/FDS/FDS6/bin/) uses the==comparison operator inside single square brackets ([ "$PATH" == "" ]) in itsifconditions. This is not POSIX-compliant syntax for thetestcommand (only a single=is valid there). Whilebashsilently accepts this as an extension, sourcing the script underzshfails, becausezshtries to resolve the second=via its EQUALS expansion and cannot find a matching command.Steps to reproduce the behavior:
/Applications/FDS/FDS6/)zshas the default shell.zprofile:source /Applications/FDS/FDS6/bin/FDS6VARS.shsource .zprofile/Applications/FDS/FDS6/bin/FDS6VARS.sh:3: = not foundExpected behavior
The script should run without errors and correctly set the environment variables (
PATH,DYLD_LIBRARY_PATH,OPAL_PREFIX,TMPDIR,OMP_NUM_THREADS), regardless of whether it is sourced withbashorzsh.Desktop
Suggested fix for
FDS6VARS.sh:Additionally, line 1 is missing the exclamation mark in the shebang (
#/bin/bashinstead of#!/bin/bash).It should also be checked whether
SMV6VARS.shcontains the same issue (==instead of=)