192 |
- |
1 |
# /etc/bashrc
|
|
|
2 |
|
|
|
3 |
# System wide functions and aliases
|
|
|
4 |
# Environment stuff goes in /etc/profile
|
|
|
5 |
|
|
|
6 |
# It's NOT a good idea to change this file unless you know what you
|
|
|
7 |
# are doing. It's much better to create a custom.sh shell script in
|
|
|
8 |
# /etc/profile.d/ to make custom changes to your environment, as this
|
|
|
9 |
# will prevent the need for merging in future updates.
|
|
|
10 |
|
|
|
11 |
# Prevent doublesourcing
|
|
|
12 |
if [ -z "$BASHRCSOURCED" ]; then
|
|
|
13 |
BASHRCSOURCED="Y"
|
|
|
14 |
|
|
|
15 |
# are we an interactive shell?
|
|
|
16 |
if [ "$PS1" ]; then
|
|
|
17 |
if [ -z "$PROMPT_COMMAND" ]; then
|
|
|
18 |
case $TERM in
|
|
|
19 |
xterm*|vte*)
|
|
|
20 |
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
|
|
|
21 |
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
|
|
|
22 |
elif [ "${VTE_VERSION:-0}" -ge 3405 ]; then
|
|
|
23 |
PROMPT_COMMAND="__vte_prompt_command"
|
|
|
24 |
else
|
|
|
25 |
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
|
|
|
26 |
fi
|
|
|
27 |
;;
|
|
|
28 |
screen*)
|
|
|
29 |
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
|
|
|
30 |
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
|
|
|
31 |
else
|
|
|
32 |
PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
|
|
|
33 |
fi
|
|
|
34 |
;;
|
|
|
35 |
*)
|
|
|
36 |
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
|
|
|
37 |
;;
|
|
|
38 |
esac
|
|
|
39 |
fi
|
|
|
40 |
# Turn on parallel history
|
|
|
41 |
shopt -s histappend
|
|
|
42 |
history -a
|
|
|
43 |
# Turn on checkwinsize
|
|
|
44 |
shopt -s checkwinsize
|
|
|
45 |
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
|
|
|
46 |
# You might want to have e.g. tty in prompt (e.g. more virtual machines)
|
|
|
47 |
# and console windows
|
|
|
48 |
# If you want to do so, just add e.g.
|
|
|
49 |
# if [ "$PS1" ]; then
|
|
|
50 |
# PS1="[\u@\h:\l \W]\\$ "
|
|
|
51 |
# fi
|
|
|
52 |
# to your custom modification shell script in /etc/profile.d/ directory
|
|
|
53 |
fi
|
|
|
54 |
|
|
|
55 |
if ! shopt -q login_shell ; then # We're not a login shell
|
|
|
56 |
# Need to redefine pathmunge, it gets undefined at the end of /etc/profile
|
|
|
57 |
pathmunge () {
|
|
|
58 |
case ":${PATH}:" in
|
|
|
59 |
*:"$1":*)
|
|
|
60 |
;;
|
|
|
61 |
*)
|
|
|
62 |
if [ "$2" = "after" ] ; then
|
|
|
63 |
PATH=$PATH:$1
|
|
|
64 |
else
|
|
|
65 |
PATH=$1:$PATH
|
|
|
66 |
fi
|
|
|
67 |
esac
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
# By default, we want umask to get set. This sets it for non-login shell.
|
|
|
71 |
# Current threshold for system reserved uid/gids is 200
|
|
|
72 |
# You could check uidgid reservation validity in
|
|
|
73 |
# /usr/share/doc/setup-*/uidgid file
|
|
|
74 |
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
|
|
|
75 |
umask 002
|
|
|
76 |
else
|
|
|
77 |
umask 022
|
|
|
78 |
fi
|
|
|
79 |
|
|
|
80 |
SHELL=/bin/bash
|
|
|
81 |
# Only display echos from profile.d scripts if we are no login shell
|
|
|
82 |
# and interactive - otherwise just process them to set envvars
|
|
|
83 |
for i in /etc/profile.d/*.sh; do
|
|
|
84 |
if [ -r "$i" ]; then
|
|
|
85 |
if [ "$PS1" ]; then
|
|
|
86 |
. "$i"
|
|
|
87 |
else
|
|
|
88 |
. "$i" >/dev/null
|
|
|
89 |
fi
|
|
|
90 |
fi
|
|
|
91 |
done
|
|
|
92 |
|
|
|
93 |
unset i
|
|
|
94 |
unset -f pathmunge
|
|
|
95 |
fi
|
|
|
96 |
|
|
|
97 |
fi
|
|
|
98 |
# vim:ts=4:sw=4
|