The "if: Expression Syntax" error can occur if you have the SHELL environment variable set to something different than what is expected. For example, one MATLAB user reported this error and was able to trace it to their use of "tcsh" instead of "csh." Once they explicitly set the SHELL variable in .matlab6rc.sh to "csh" the "if: Expression Syntax" was resolved.
The "tcsh: using dumb terminal settings" was corrected when the user changed a different environment variable in .tcshrc using the following command:
Note: The method for setting environment variables depends on which shell you are using.
If you are using "csh" or "tcsh", the "if: Expression Syntax" error may also occur as a result of a syntax error in either the .cshrc or .tcshrc files. Please examine the appropriate file for any errors. Alternatively, you can have MATLAB use "sh" by entering the following before starting MATLAB:
setenv MATLAB_SHELL=/bin/sh
If you are getting the error about unknown terminal type, this is happening because Terminal Emulation is not supported in MATLAB. Instead of using the following command
you should try using this command:
Some additional information on the related UNIX/Linux command bang (!) and why it might not work in the UNIX/Linux version of MATLAB can be found below:
Best Answer