How to Update to Bash 4.2 on Solaris 9 or 10 (SPARC)


I had to update our UNIX hosts to Bash 4.2 this week. This allows us to take advantage of the newer BASH features not present in the shipping builds.

This article will:

  • Show where you can get Bash 4.2 (binary) + Related dependencies
  • Install them on your Sun Solaris 9 (SPARC) machine

Notes:

Since Bash 2.0.5 is WAY OLD and I want to use features found in v3.2 or later, here are steps for updating to bash 4.2 on Solaris 9

 

Part 1: Acquire the binary packages

NOTE: It looks like sunfreeware.com no longer provides the Solaris 9 packages for free. I am mirroring them here for future use:

 

Here are the links to the Solaris 10 packages (still available from sunfreeware.com):

 

Part 2: Transfer them via scp/sftp

 

Part 3: Install the packages

Run these commands:

  • pkgadd -d libgcc
  • pkgadd -d libiconv
  • pkgadd -d libintl
  • pkgadd -d bash

This should install the packages to /usr/local/bin. This DOES NOT overwrite the existing bash 2.0.5 installation.

 

Part 4: Get the new bash to replace the old one

This set of commands worked for me. Be careful here- test before running on an important machine!:

  • ln /usr/local/bin/bash bash.link
  • mv bash.link /bin
  • mv /bin/bash /bin/bash.old
  • mv bash.link bash

The point here is to not delete the old bash, just rename it so any new bash scripts that run will have the Bash 4.2 treatment. The old bash will be present as bash.old