/bin/sh -> bash :(

Some of us have odd requirements in life..

HP-UX, Soalris, AIX take your pick of any of he \”real\” unix flavors  they all have a real bourne shell. Usually modified a lot but its still bourne shell no matter how you look at it and still retains usually a lot of the older syntax and quirks of bourne shell.

Jump across to Linux.. hmmm no bourne shell! /bin/sh is a symlink to bash shell.  I like bash shell it makes my life easier.
So whats the issue.. Well as a good friend pointed out to me if we are writing stuff on unix machines and trying to test things at home and well maybe you don\’t have enough systems or don\’t have the same OS or the H/W to run it, or maybe you are transitioning your infrastructure to linux from something. Lets use linux  ok not the best idea but a valid one someday\’s. Now take that huge ass shell script you wrote and try run that on the bash shell.

oh.. epic fail.
You can use korn shell to some degree but that\’s not perfect. Works about 98%.

Or you can compile the real bourne shell!
I was given the following link to a copy of the bourne shell source code. Its quite hard to get surprising

The following steps are quite basic, we are just going to check out the code and compile it under Gentoo.
Note the following will NOT overwrite the /bin/sh symlink.ls

Commands are in Italics

  1. Check out the source code from CVS. Change to your build directory.
    # cvs -d:pserver:anonymous@heirloom.cvs.sourceforge.net:/cvsroot/heirloom login
    Hit enter when asked for a password
    # cvs -d:pserver:anonymous@heirloom.cvs.sourceforge.net:/cvsroot/heirloom co -P heirloom-sh
    Change directory into the heirloom-sh directory and edit the makefile.
    You must change the \”UCBINST\” option to point to /usr/bin/install
    Other things you may want to look at are install directory\’s and compiler flags. I\’ve set up my CFLAGS to be the same as my make.conf file from my system.
    # make
    # make install

And thats it your done, you now have a real bourne shell. Use it for what ever  wack needs you may have.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: