]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - pkgs/core/bash/bashrc
5afd45302c3ab37882c28ebcf34c20678e2a9605
[people/ms/ipfire-3.x.git] / pkgs / core / bash / bashrc
1 # /etc/bashrc
2
3 # System wide functions and aliases
4 # Environment stuff goes in /etc/profile
5
6 # It's NOT good idea to change this file unless you know what you
7 # are doing. Much better way is to create custom.sh shell script in
8 # /etc/profile.d/ to make custom changes to environment. This will
9 # prevent need for merging in future updates.
10
11 # By default, we want this to get set.
12 # Even for non-interactive, non-login shells.
13 # Current threshold for system reserved uid/gids is 200
14 # You could check uidgid reservation validity in
15 # /usr/share/doc/setup-*/uidgid file
16 if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
17 umask 002
18 else
19 umask 022
20 fi
21
22 # are we an interactive shell?
23 if [ "$PS1" ]; then
24 case $TERM in
25 xterm*)
26 if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
27 PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
28 else
29 PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
30 fi
31 ;;
32 screen)
33 if [ -e /etc/sysconfig/bash-prompt-screen ]; then
34 PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
35 else
36 PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'
37 fi
38 ;;
39 *)
40 [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
41 ;;
42 esac
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 get's 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 # Only display echos from profile.d scripts if we are no login shell
71 # and interactive - otherwise just process them to set envvars
72 for i in /etc/profile.d/*.sh; do
73 if [ -r "$i" ]; then
74 if [ "$PS1" ]; then
75 . $i
76 else
77 . $i >/dev/null 2>&1
78 fi
79 fi
80 done
81
82 unset i
83 unset pathmunge
84 fi
85 # vim:ts=4:sw=4