| 3 |
- |
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 |
# are we an interactive shell?
|
|
|
12 |
if [ "$PS1" ]; then
|
|
|
13 |
if [ -z "$PROMPT_COMMAND" ]; then
|
|
|
14 |
case $TERM in
|
|
|
15 |
xterm*)
|
|
|
16 |
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
|
|
|
17 |
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
|
|
|
18 |
else
|
|
|
19 |
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
|
|
|
20 |
fi
|
|
|
21 |
;;
|
|
|
22 |
screen)
|
|
|
23 |
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
|
|
|
24 |
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
|
|
|
25 |
else
|
|
|
26 |
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
|
|
|
27 |
fi
|
|
|
28 |
;;
|
|
|
29 |
*)
|
|
|
30 |
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
|
|
|
31 |
;;
|
|
|
32 |
esac
|
|
|
33 |
fi
|
|
|
34 |
# Turn on checkwinsize
|
|
|
35 |
shopt -s checkwinsize
|
|
|
36 |
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
|
|
|
37 |
# You might want to have e.g. tty in prompt (e.g. more virtual machines)
|
|
|
38 |
# and console windows
|
|
|
39 |
# If you want to do so, just add e.g.
|
|
|
40 |
# if [ "$PS1" ]; then
|
|
|
41 |
# PS1="[\u@\h:\l \W]\\$ "
|
|
|
42 |
# fi
|
|
|
43 |
# to your custom modification shell script in /etc/profile.d/ directory
|
|
|
44 |
fi
|
|
|
45 |
|
|
|
46 |
if ! shopt -q login_shell ; then # We're not a login shell
|
|
|
47 |
# Need to redefine pathmunge, it get's undefined at the end of /etc/profile
|
|
|
48 |
pathmunge () {
|
|
|
49 |
case ":${PATH}:" in
|
|
|
50 |
*:"$1":*)
|
|
|
51 |
;;
|
|
|
52 |
*)
|
|
|
53 |
if [ "$2" = "after" ] ; then
|
|
|
54 |
PATH=$PATH:$1
|
|
|
55 |
else
|
|
|
56 |
PATH=$1:$PATH
|
|
|
57 |
fi
|
|
|
58 |
esac
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
# By default, we want umask to get set. This sets it for non-login shell.
|
|
|
62 |
# Current threshold for system reserved uid/gids is 200
|
|
|
63 |
# You could check uidgid reservation validity in
|
|
|
64 |
# /usr/share/doc/setup-*/uidgid file
|
| 95 |
- |
65 |
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
|
| 3 |
- |
66 |
umask 002
|
|
|
67 |
else
|
|
|
68 |
umask 022
|
|
|
69 |
fi
|
|
|
70 |
|
|
|
71 |
# Only display echos from profile.d scripts if we are no login shell
|
|
|
72 |
# and interactive - otherwise just process them to set envvars
|
|
|
73 |
for i in /etc/profile.d/*.sh; do
|
|
|
74 |
if [ -r "$i" ]; then
|
|
|
75 |
if [ "$PS1" ]; then
|
|
|
76 |
. "$i"
|
|
|
77 |
else
|
|
|
78 |
. "$i" >/dev/null 2>&1
|
|
|
79 |
fi
|
|
|
80 |
fi
|
|
|
81 |
done
|
|
|
82 |
|
|
|
83 |
unset i
|
|
|
84 |
unset pathmunge
|
|
|
85 |
fi
|
|
|
86 |
# vim:ts=4:sw=4
|