source: projects/setup/trunk/bashrc @ 8718

Revision 8718, 2.8 KB checked in by daisuke, 10 years ago (diff)

update to 2.9.0

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