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