Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

sh incompatibility in mklvars.sh

Matthias_Kretz
New Contributor I
140 Views
Hi,

the mklvars.sh script shipped with the Linux edition of the Intel compiler fails to work on zsh because it is sh incompatible: The use of [ "" == "" ] is incorrect and instead [ "" = "" ] must be used.

I had to patch that script to be able to use the environment script provided by the package.

Cheers,
Matthias
0 Kudos
5 Replies
JenniferJ
Moderator
140 Views
Thanks for letting us know.

I'll file a bug report about it.

Jennifer
barragan_villanueva_
Valued Contributor I
140 Views
Hi,

According to man sh

CONDITIONAL EXPRESSIONS

Conditional expressions are used by the [[ compound command and the test and [ builtin commands to test file attributes and perform

string and arithmetic comparisons.

string1 == string2

True if the strings are equal. = may be used in place of == for strict POSIX compliance.

So, '==' is OK

mecej4
Black Belt
140 Views
So, '==' is OK

Yes, but not if Zsh expects POSIX compliance or does not understand Bash extensions to sh.
barragan_villanueva_
Valued Contributor I
140 Views
Looking at "info Zsh" (Conditional Expressions) (zsh 4.2.6)

STRING = PATTERN
STRING == PATTERN
true if STRING matches PATTERN. The `==' form is the preferred
one. The `=' form is for backward compatibility and should be
considered obsolete.

Therefore, Zsh must workas sh and bash
dschwen
Beginner
140 Views
Zsh needs the == to be escaped (\=\=), which bash accepts but not sh.
There obviously is a problem for several users here, which has an easy solution: respecting POSIX compliance.
The single = works as expected in all three shells.
Reply