1、下载下面的链接的软件包(链接测试时间:2010-11-2)
http://hpux.its.tudelft.nl/hppd/hpux/Shells/bash-4.1.007/ http://hpux.its.tudelft.nl/hppd/hpux/Gnu/gettext-0.18.1.1/ http://hpux.its.tudelft.nl/hppd/hpux/Development/Libraries/libiconv-1.13.1/ http://hpux.its.tudelft.nl/hppd/hpux/Development/Libraries/termcap-1.3.1/ http://hpux.connect.org.uk/hppd/hpux/Gnu/make-3.82/
2、解压并安装上面的软件包(注意顺序):
swinstall -s /opt/tmp/make-3.82-ia64-11.31.depot swinstall -s /opt/tmp/gettext-0.18.1.1-ia64-11.31.depot swinstall -s /opt/tmp/libiconv-1.13.1-ia64-11.31.depot swinstall -s /opt/tmp/termcap-1.3.1-ia64-11.31.depot swinstall -s /opt/tmp/bash-4.1.007-ia64-11.31.depot3、使用bash: 增加bash的配置文件:~/.bash_profile ~/.bashrc /etc/bashrc
[larry@hpux01 ~]$ cat .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin:/usr/sbin:/usr/local/bin export PATH unset USERNAME
[larry@hpux01 ~]$ cat ~/.bashrc # Source global definitions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' if [ -f /etc/bashrc ]; then . /etc/bashrc fi [larry@hpux01 ~]$ cat /etc/bashrc # by default, we want this to get set. # Even for non-interactive, non-login shells. if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then umask 002 else umask 022 fi # are we an interactive shell? if [ "$PS1" ]; then if [ -x /usr/bin/tput ]; then if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal stty erase `tput kbs` elif [ -x /usr/bin/wc ]; then if [ "`tput kbs|wc -c `" -gt 0 ]; then # We can't do this with "dumb" terminal stty erase `tput kbs` fi fi fi case $TERM in xterm*) if [ -e /etc/sysconfig/bash-prompt-xterm ]; then PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm else PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' fi ;; screen) PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"' ;; *) [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default ;; esac [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " if [ "x$SHLVL" != "x1" ]; then # We're not a login shell for i in /etc/profile.d/*.sh; do if [ -r "$i" ]; then . $i fi done fi fi # vim:ts=4:sw=4 export PATH="$PATH:/usr/sbin" export PATH="$PATH:/usr/local/sbin" export PATH="$PATH:/sbin" export TERM="vt100"
用vipw更新/etc/passwd文件,更改相应用户的默认shell
<
vipw
larry:dG/rFtUk2maK.:103:20::/home/larry:/usr/local/bin/bash
如果是root用户,建议不要直接使用/usr/local/bin/bash,原因是因为在进入维护模式时,只会挂载/分区,不会挂/usr.如果使用/usr/local/bin/bash,会无法进入维护模式。解决方法是,root使用/sbin/sh,在root的主目录下生成一个.profile文件,在最后一行来调用bash,如果调用不成功,至少还有/sbin/sh可用。内容如下:
[root@pass9db02 ~]# cat .profile # @(#)B.11.31_LR # Default (example of) super-user's .profile file # Do not put "." in PATH; it is a potential security breach. # Do not put "/usr/local/bin" in PATH; it is a potential security breach. # Example assumes /home/root exists. set +u PATH=/usr/sbin:$PATH:/sbin:/home/root # Be sure that VUE does not invoke tty commands if [ ! "$VUE" ]; then # Set up the terminal: if [ "$TERM" = "" ] then eval ` tset -s -Q -m ':?hp' ` else eval ` tset -s -Q ` fi stty erase "^H" kill "^U" intr "^C" eof "^D" stty hupcl ixon ixoff tabs echo echo "Value of TERM has been set to \"$TERM\". " export TERM EDITOR=vi export EDITOR fi # if !VUE # Set up shell environment: set -u # error if undefined variable. trap "echo 'logout root'" 0 # what to do on exit. # Set up shell variables: MAIL=/var/mail/root # don't export, so only login shell checks. echo "WARNING: YOU ARE SUPERUSER !!\n" /usr/local/bin/bash