1752590 Members
4267 Online
108788 Solutions
New Discussion

bash

 
shaw_net
Occasional Contributor

bash

how can i set or install bash when login to root on HP-UX B.11.11, i have /sbin/sh set for root user. i need bash to see history and arroy keys to move across when typing commands at login prompt

6 REPLIES 6
Torsten.
Acclaimed Contributor

Re: bash

Keep /sbin/sh as default.

Otherwise you may get into serious trouble.

Type "bash" once logged on.


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
KishJ
HPE Pro

Re: bash

Greetings,

Please note that Bash Shell does not come with HP-UX. In other words, it is available as Open Source and hence isn't supported by HPE. You may use it at your own disk and any assistance on the product should also be sought from the source or Open-Source community. It is not recommemded for root user in specific.

Please check usage of SHELL variable in the respective profiles. For details kindly refer man page of login. 

Also, applications can have their own shell exported from the respecive profile or environment files.

For more details on the bash shell, you may refer the link - http://hpux.connect.org.uk/hppd/hpux/Shells/bash-5.0.011/man.html

 


I am a HPE Employee

Accept or Kudo

Steven Schweda
Honored Contributor

Re: bash

> Keep /sbin/sh as default.
> Otherwise you may get into serious trouble.

   I agree.  When HP-UX starts, the only available file system may be
"/".  For "/sbin/sh", that should not be a problem:

dy# uname -a
HP-UX dy B.11.11 U 9000/785 2012616114 unlimited-user license

dy# ldd /sbin/sh
ldd: "/sbin/sh" is not a shared executable.

   For any other shell, you might also need "/usr" (or who knows what?):

dy# ldd /bin/sh
        /usr/lib/libc.2 =>      /usr/lib/libc.2
        /usr/lib/libdld.2 =>    /usr/lib/libdld.2
        /usr/lib/libc.2 =>      /usr/lib/libc.2

dy# ldd /usr/local/bin/bash
      /usr/lib/libdld.2 =>    /usr/lib/libdld.2
      /usr/lib/libc.2 =>      /usr/lib/libc.2
      /usr/lib/libdld.2 =>    /usr/lib/libdld.2
      /usr/local/lib/libiconv.sl =>   /usr/local/lib/libiconv.sl
      /usr/lib/libc.2 =>      /usr/lib/libc.2
      /usr/local/lib/libintl.sl =>    /usr/local/lib/libintl.sl
      /usr/local/lib/libiconv.sl =>   /usr/local/lib/libiconv.sl

   So, if you specify a normal shell, and those libraries are not
available, then "serious trouble".

> Type "bash" once logged on.

   Or, add a line like the following to (the end of) your ~/.profile"
file:

      exec bash

   If the default shell can't find "bash", then the "exec" fails, and
you've lost nothing (I believe).  If it _can_ find "bash", then you'll
be running "bash".  Options like "-i" or "-l" might be useful, but I
never bothered.

dy# echo $0
bash

dy# type history
history is a shell builtin

Bill Hassell
Honored Contributor

Re: bash

The bash excutable is not part of HP-UX. And unfortunately, the HP-UX porting center has removed all products for HP-UX prior to 11.31 including 11.11.

However, HPE has been supplying many of the Open Source tools comonly found in Unix-style systems. The location is:


https://h20392.www2.hpe.com/portal/swdepot/index.do

If you search for the words: internet express, you'll see the the Open Source packages.

But unfortunately, HPE has removed the 11.11 version of the collection.

You may not be aware but HP-UX version 11.11 has been obsolete and unsupported for more than 10 years.

So your last resort is H. Merijn Brand's web page of Open Source packages for old systems:

http://mirrors.develooper.com/hpux/downloads.html

Now, as mentioned, bash should not be used for the root user's shell. It cannot run in single user mode due to shared libraries. Leave root's shell as /sbin/sh which works OK in single user mode.

Note also that the POSIX shell (/sbin/sh) does have a history file (in $HOME/.sh_history. You may need to create it and adad two variables to /etc/profile:

   export HISTFILE=${HISTFILE:-$HOME/.sh_history}  # if not set already
   export HISTSIZE=5000                            # history file size

The history command is an alias for fc. You can see this with the type command:

# type history
history is an exported alias for fc -l

Note that recalling history and editing command lines is different than Linux.

If you don't want to learn about the POSIX shell, you can login as root and then type bash.

 



Bill Hassell, sysadmin
Steven Schweda
Honored Contributor

Re: bash

> # type history
> history is an exported alias for fc -l

   I exhibited that command to demonstrate that I was running "bash",
not because anyone cared about "history".  Thanks for supplying the
other half of that demonstration.

> If you don't want to learn about the POSIX shell, [...]

   Not the only possible reason.

> [...] you can login as root and then type bash.

   Or, as I explained, add a line to your ".profile" file, and have it
done automatically, when possible.  (Why automate any procedure if it
can be done manually?)

> [...] the HP-UX porting center has removed [...]

> [...] unfortunately, HPE has removed [...]

   I probably built mine from source using gcc.  Getting that whole tool
chain running now from scratch could be difficult.

ranganath ramachandra
Esteemed Contributor

Re: bash


@shaw_net wrote:

i need bash to see history and arroy keys to move across when typing commands at login prompt


You can do this in the default ksh with a little customization, according to this solution. It says to add these lines into your .kshrc/.shrc

 

set -o emacs
alias __A='^P'
alias __B='^N'
alias __C='^F'
alias __D='^B'

 

Note that the strings within quotes are special characters. '^P' is not '^' followed by 'P', it has to be entered as Ctrl-V followed by Ctrl-P in vi.


@shaw_net wrote:

how can i set or install bash when login to root on HP-UX B.11.11, i have /sbin/sh set for root user.


You can download it from HPUX-connect. Once you have it installed, use chsh to set the login shell:

 

chsh /usr/bin/bash

 

However as others have mentioned, it may not be good to have bash as the login shell for root.

 
--
ranga
[i work for hpe]

Accept or Kudo