Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

Fix for broken script compilervars.sh with zsh on MacOS after latest compiler upgrade

FDuncanH
Beginner
1,209 Views

The most recent version of the shell script compilervars.sh added a section  to

remove duplicate paths.     Its fine for bash, but breaks zsh (whis no default in MacOS.

"echo $(!arg) "  is incorrect  syntax in  the zshell scripting.

 I found the fix below ,   It might be useful for anyone using zhell on macos.

I not sure how to report this to the product team.

(the uncorrected script destroys $PATH  for command line users))

 

Broken script

------------------function remove_duplicate_paths----------------------------

remove_duplicate_paths() {
local arg=$1

if [ "${INTEL_HOST_PLATFORM}" = "Darwin" ]; then
local arr=(`echo ${!arg} | sed 's/:/\'$'\n/g'`)
else
local arr=(`echo ${!arg} | sed 's/:/\n/g'`)
fi

fixed script below


# ------------------function remove_duplicate_paths----------------------------
remove_duplicate_paths() {
local arg=$1
eval "value=\"\${$arg}\""
if [ "${INTEL_HOST_PLATFORM}" = "Darwin" ]; then
local arr=(`echo ${value} | sed 's/:/\'$'\n/g'`)
else
local arr=(`echo ${!arg} | sed 's/:/\n/g'`)
fi

Labels (1)
1 Reply
Ron_Green
Moderator
1,191 Views

we know about this one.  We have, to date, not supported zsh.  Given that Apple is forcing us to zsh we're adding full POSIX support for zsh and ksh in a future update.

Simplest workaround is:

% bash -c 'source /opt/intel/bin/compilervars.sh intel64 ; exec zsh'

Which will end up with a new zsh instance, so if you exit from the new instance you will lose the env vars.

0 Kudos
Reply