AIX7.1 上编译安装 bash 4.2
(2014-07-17 14:29:24)
编译安装
./configure
--prefix=/usr 和 make & make
install
编译完成后的配置过程
step 1:
修改
/etc/security/login.cfg ,在其中的 usw: 项的 shells 中加入
/usr/bin/bash
加入该内容是为了让你在创建用户的时候,可以选择默认的 shell 的时候可以选择
bash.
step 2:
在 /etc 目录下添加
bashrc 的配置文件,并修改该文件权限为所用的用户可以读和执行。
bashrc
文件内容如下:
- # /etc/bashrc
- # System wide functions and
aliases
- # Environment stuff goes in
/etc/profile
- # It's NOT a good idea to
change this file unless you know what you
- # are doing. It's much
better to create a custom.sh shell script in
- # /etc/profile.d/ to make
custom changes to your environment, as this
- # will prevent the need for
merging in future updates.
- # are we an interactive
shell?
- if [ "$PS1" ];
then
-
if [ -z "$PROMPT_COMMAND" ];
then
-
case $TERM in
-
xterm*)
-
if [ -e
/etc/sysconfig/bash-prompt-xterm ]; then
-
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
-
else
-
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007"
"${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
-
fi
-
;;
-
screen)
-
if [ -e
/etc/sysconfig/bash-prompt-screen ]; then
-
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
-
else
-
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\"
"${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
-
fi
-
;;
-
*)
-
[ -e
/etc/sysconfig/bash-prompt-default ] &&
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
-
;;
-
esac
-
fi
-
# Turn on
checkwinsize
-
shopt -s checkwinsize
-
[ "$PS1" = "\\s-\\v\\\$ " ]
&& PS1="[\u@\h \W]\\$ "
-
# You might want to have e.g.
tty in prompt (e.g. more virtual machines)
-
# and console windows
-
# If you want to do so, just
add e.g.
-
# if [ "$PS1" ]; then
-
#
PS1="[\u@\h:\l \W]\\$ "
-
# fi
-
# to your custom modification
shell script in /etc/profile.d/ directory
- fi
- if ! shopt -q login_shell ;
then # We're not a login shell
-
# Need to redefine pathmunge, it get's undefined
at the end of /etc/profile
-
pathmunge () {
-
case
":${PATH}:" in
-
*:"$1":*)
-
;;
-
*)
-
if [ "$2" =
"after" ] ; then
-
PATH=$PATH:$1
-
else
-
PATH=$1:$PATH
-
fi
-
esac
-
}
-
# By default, we want umask to get set. This
sets it for non-login shell.
-
# Current threshold for system reserved uid/gids
is 200
-
# You could check uidgid reservation validity
in
-
# /usr/share/doc/setup-*/uidgid file
-
if [ $UID -gt 199 ] && [ "`id -gn`" =
"`id -un`" ]; then
-
umask
002
-
else
-
umask
022
-
fi
-
# Only display echos from profile.d scripts if
we are no login shell
-
# and interactive - otherwise just process them
to set envvars
-
for i in /etc/profile.d/*.sh; do
-
if [ -r "$i"
]; then
-
if [ "$PS1"
]; then
-
.
"$i"
-
else
-
. "$i"
>/dev/null 2>&1
-
fi
-
fi
-
done
-
unset i
-
unset pathmunge
- fi
- export PS1="\u: \w\\$
"
- # vim:ts=4:sw=4
复制代码
step
3:
修改
/etc/security/.profile 文件,加入在使用 bash 的时候的环境变量配置
内容如下:
- if [ $SHELL ==
'/usr/bin/bash' ]; then
-
if [ -f
/etc/bashrc ]; then
-
.
/etc/bashrc
-
fi
-
fi
复制代码
经过如此修改后,我们再创建用户的时候可以选择该用户的默认使用的
shell ,同时在使用 bash 的时候,其环境变量也会自动载入了。
喜欢
0
赠金笔
加载中,请稍候......