Bash on Unix (HP-UX)

History

Bourne Shell,” .sh” was developed by Stephen Bourne in 1977. Most of the unix system V still keep the Bourne Shell in their system such as in HP-UX:

$ uname -a;ll /bin/sh
HP-UX Node B.11.31 U ia64 1371064322 unlimited-user license
-r-xr-xr-x 2 bin bin 683144 Dec 8 2017 /bin/sh
$

Meanwhile the Korn Shell or ksh was initially released on 1983 under AT&T licenses and was developed by David Korn. The ksh was the default shell for HP-UX and known faster in processing the loop syntax compared to Bash shell.  Besides, the most common used now in unix-like operating system is Bash shell or Bourne Again Shell which developed by Brian Fox in 1989 and licensed under GNU. Why Bourne-Again? this is because of the some of features were copied over from Bourne/.sh shell such as “history” commands.

Issues

There are a lot of shell type used by the users nowadays, but only a few was the famous ones including ksh, sh,  and bash. The issue happens when the commands is not working but it does in the bash shell. For example, the recall run previous commands by using up and down arrows in bash shell that do not work on ksh shell. But, we may use “Escape” keys twice on ksh shell to do the same features even though it has less comfort because of the changing of the pointer to the one character backwards every time the “Escape” keys entered on the first time.

Resolutions

To cater this issues, we may use the bash shell on the unix operating system by installing it altogether with their dependencies. There were three of them that required by bash package before it can be working as fine as in linux operating system. Below is the dependencies:

1)gettext – used to change the language (such as locale in numbers)

2)libiconv – is a conversion library for both kinds of applications in unix OS and bash shell

3)termcap – to provides terminal types for many screen sizes. (for example vt100 in HP-UX support a full 24 lines of text in 132 column mode)

Sample Setup

1) Install bash package and its dependencies

swinstall -s <depot server>:/<path of package> bash

swinstall -s <depot server>:/<path of package>gettext

swinstall -s <depot server>:/<path of package> libiconv

swinstall -s <depot server>:/<path of package> termcap

2) Verify the installed package

Node:home/user# swlist|grep -iE ‘bash|gett|libico|termc’
bash 4.3.028 bash
gettext 0.18.1.1 gettext
libiconv 1.14 libiconv
termcap 1.3.1 termcap
Node:home/user#

3) Linking the path of bash to the default path in HP-UX

ln -s /usr/local/bin/bash /bin/bash

Node:home/user# ll /bin/bash
lrwxr-xr-x 1 root sys 19 Aug 8 07:10 /bin/bash -> /usr/local/bin/bash
Node:home/user#

4) Verify the bash installation

$ whoami
user
$ echo $SHELL
/usr/bin/ksh
$ sudo bash
Last successful login: Tue Aug 6 04:59:43 UTC 2019
bash-4.3#

Conclusion

1) ksh shell on unix seems to have more faster processing compared to bash shell especially in loop syntax but bash having more faster in tab completion.

2) bash shell having more features as it more newer than ksh shell and mlocate utility in bash seems to works faster compared to find utility because it process through the database but only sync once a day in cron.daily.

3) Recalling previous run commands through up and down arrows looks more convenient for sysadmin because it will smooth-en the administrative task that normally require faster commands in business critical systems.

 

References

https://en.wikipedia.org/wiki/UNIX_System_V, Aug 2019

https://en.wikipedia.org/wiki/Bash_(Unix_shell), July 2019

https://en.wikipedia.org/wiki/Bourne_shell, December 2018

https://www.gnu.org/software/termutils/manual/termcap-1.3/html_mono/termcap.html, November 1998

https://www.gnu.org/software/gettext/manual/gettext.html,

https://www.gnu.org/software/libiconv/, May 2019

https://www.cyberciti.biz/faq/ksh-for-loop/, Aug 2009

https://www.cyberciti.biz/faq/bash-for-loop/, Dec 2018

http://www.masteringunixshell.net/qa51/bash-vs-ksh.html

https://en.wikipedia.org/wiki/KornShell, July 2019

https://en.wikipedia.org/wiki/VT100, May 2019