加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

AIX7.1 上编译安装 bash 4.2

(2014-07-17 14:29:24)
标签:

bash

unix

linux

shell

分类: Linux/Unix
编译安装
 ./configure --prefix=/usr 和 make & make install 

编译完成后的配置过程

step 1:
               修改 /etc/security/login.cfg ,在其中的 usw: 项的 shells 中加入 /usr/bin/bash 
               加入该内容是为了让你在创建用户的时候,可以选择默认的 shell 的时候可以选择 bash.

step 2:
              在 /etc 目录下添加 bashrc 的配置文件,并修改该文件权限为所用的用户可以读和执行。
              bashrc 文件内容如下:
  1. # /etc/bashrc

  2. # System wide functions and aliases
  3. # Environment stuff goes in /etc/profile

  4. # It's NOT a good idea to change this file unless you know what you
  5. # are doing. It's much better to create a custom.sh shell script in
  6. # /etc/profile.d/ to make custom changes to your environment, as this
  7. # will prevent the need for merging in future updates.

  8. # are we an interactive shell?
  9. if [ "$PS1" ]; then
  10.   if [ -z "$PROMPT_COMMAND" ]; then
  11.     case $TERM in
  12.     xterm*)
  13.         if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
  14.             PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
  15.         else
  16.             PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
  17.         fi
  18.         ;;
  19.     screen)
  20.         if [ -e /etc/sysconfig/bash-prompt-screen ]; then
  21.             PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
  22.         else
  23.             PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
  24.         fi
  25.         ;;
  26.     *)
  27.         [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
  28.         ;;
  29.       esac
  30.   fi
  31.   # Turn on checkwinsize
  32.   shopt -s checkwinsize
  33.   [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
  34.   # You might want to have e.g. tty in prompt (e.g. more virtual machines)
  35.   # and console windows
  36.   # If you want to do so, just add e.g.
  37.   # if [ "$PS1" ]; then
  38.     PS1="[\u@\h:\l \W]\\$ "
  39.   # fi
  40.   # to your custom modification shell script in /etc/profile.d/ directory
  41. fi

  42. if ! shopt -q login_shell ; then # We're not a login shell
  43.     # Need to redefine pathmunge, it get's undefined at the end of /etc/profile
  44.     pathmunge () {
  45.         case ":${PATH}:" in
  46.             *:"$1":*)
  47.                 ;;
  48.             *)
  49.                 if [ "$2" = "after" ] ; then
  50.                     PATH=$PATH:$1
  51.                 else
  52.                     PATH=$1:$PATH
  53.                 fi
  54.         esac
  55.     }

  56.     # By default, we want umask to get set. This sets it for non-login shell.
  57.     # Current threshold for system reserved uid/gids is 200
  58.     # You could check uidgid reservation validity in
  59.     # /usr/share/doc/setup-*/uidgid file
  60.     if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
  61.        umask 002
  62.     else
  63.        umask 022
  64.     fi

  65.     # Only display echos from profile.d scripts if we are no login shell
  66.     # and interactive - otherwise just process them to set envvars
  67.     for i in /etc/profile.d/*.sh; do
  68.         if [ -r "$i" ]; then
  69.             if [ "$PS1" ]; then
  70.                 . "$i"
  71.             else
  72.                 . "$i" >/dev/null 2>&1
  73.             fi
  74.         fi
  75.     done

  76.     unset i
  77.     unset pathmunge
  78. fi
  79. export PS1="\u: \w\\$ "
  80. # vim:ts=4:sw=4
复制代码
step 3:
               修改 /etc/security/.profile 文件,加入在使用 bash 的时候的环境变量配置
               内容如下:
  1. if [ $SHELL == '/usr/bin/bash' ]; then
  2.         if [ -f /etc/bashrc ]; then
  3.                 . /etc/bashrc
  4.         fi
  5. fi
复制代码
经过如此修改后,我们再创建用户的时候可以选择该用户的默认使用的 shell ,同时在使用 bash 的时候,其环境变量也会自动载入了。

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有