ERROR: ./install.sh: line 1199: syntax error near unexpected token `else'

  • 7005956
  • 13-May-2010
  • 26-Apr-2012

Environment


Novell eDirectory 8.8 for Linux
Novell eDirectory 8.8 Support Pack 5 for Linux

Situation

- Novell eDirectory 88 Support Pack 5 Field Test File 3 Installation fails with the following error:

ERROR: ./install.sh: line 1199: syntax error near unexpected token `else'
./install.sh: line 1199: `                else'

- No additional error messages are seen with "strace" or "sh -x" debug outputs. Running install script with "--debug" options also reveals no debug information.

- Problem is observed only on a few servers

Resolution

This is a bug with older versions of "bash". Take backups of bash profile files and upgrade the "bash" RPM to the latest version using appropriate package upgrade tools (YaST, zypper, YUM etc.)

In the lab environment with RedHat Enterprise Linux 5.1, the install was broken with bash version "3.1.16.-1" and was fixed by upgrading to "3.2.25"

If a bash upgrade is not possible, problem can be worked around by commenting the "fi" statement in the install.sh on lines 1198 and 1965 respectively as follows

  if [ "$OS" = "AIX" -a "$PKGFILE_PKG_NAME" = "NDS.NOVLncp"]; then
1962                         PKG_INSTANCE_LIST=`$CMD_SINGLE_PKG_INSTALL_CHECK $PKGFILE_PKG_NAME 2>$NULLDEV"`
1963                         if [ "$PKG_INSTANCE_LIST" = ""];then
1964                                 PKG_INSTANCE_LIST=`lslpp -l -c -q -Ou NDS.NOVLncp 2>$NULLDEV"`
1965                        ### COMMENT fi HERE ####fi
1966                 else
1967                         PKG_INSTANCE_LIST=`$CMD_SINGLE_PKG_INSTALL_CHECK $PKGFILE_PKG_NAME 2>$NULLDEV`
1968                 fi
1969                 RC=$?

Additional Information

Older versions of bash are incorrectly interpreting the "fi" bash statement of the inner "if-then-fi" loop  as the end of the outer "if-then-else-fi" loop, thereby incorrectly invalidating the script content following the inner "fi" statement.