Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
120 Views

Solution for Broken compilervars.sh with zsh (on MacOS 10.15.7) after latest compiler update.

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.

 

 

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

0 Kudos
3 Replies
Highlighted
Moderator
103 Views

Hi,

Thanks for reporting this issue and providing the workaround.

We will forward this thread to the concerned internal team to verify and get it fixed accordingly if possible.

Have a Good day!


Thanks & Regards

Goutham


0 Kudos
Highlighted
Moderator
93 Views

I've reported this to our Developer.

Thanks,


0 Kudos
Highlighted
Moderator
81 Views

0 Kudos