Syntax errors when running Intel® MPI Library scripts under Ubuntu

Problem : 

I'm trying to run the Intel® MPI Library on my Ubuntu system. Installation went fine but I see this error when trying to run:

gergana@node1:~$ mpirun -np 4 hostname
/home/gsslavov/intel/impi/<version>/bin/mpirun: 63: Syntax error: "(" unexpected (expecting "fi")

What's going on?

Environment : 

This applies to systems running Ubuntu 9.10 or later (as well as Ubuntu 8.04 LTS or later)

Root Cause : 

It seems that with version 9.10, Ubuntu has decided to change the default shell from bash to dash. More info is available from the link in the excerpt below:

In Ubuntu 6.10, the default system shell, /bin/sh, was changed to dash (the Debian Almquist Shell); previously it had been bash (the GNU Bourne-Again Shell). This document explains this change and what you should do if you encounter problems.

The default login shell remains bash.

The two shells are not fully compatible (since bash is quite more extensive than dash), thus leading to the syntax errors.

Resolution : 

If you'd like to continue using the Intel MPI Library (or any of the Cluster Tools) on Ubuntu, the fix for this issue is fairly simple: change the /bin/sh symlink to point from dash to bash:

$ rm /bin/sh
$ ln -s /bin/bash /bin/sh