]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - config/etc/bashrc
Merge remote-tracking branch 'origin/next' into thirteen
[people/teissler/ipfire-2.x.git] / config / etc / bashrc
CommitLineData
b21b0df6 1# /etc/bashrc
71e32384 2
b21b0df6
MT
3# System wide functions and aliases
4# Environment stuff goes in /etc/profile
71e32384 5
b21b0df6
MT
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.
71e32384 10
b21b0df6
MT
11# are we an interactive shell?
12if [ "$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 parallel history
35 shopt -s histappend
36 history -a
37 # Turn on checkwinsize
38 shopt -s checkwinsize
39 [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
40 # You might want to have e.g. tty in prompt (e.g. more virtual machines)
41 # and console windows
42 # If you want to do so, just add e.g.
43 # if [ "$PS1" ]; then
44 # PS1="[\u@\h:\l \W]\\$ "
45 # fi
46 # to your custom modification shell script in /etc/profile.d/ directory
47fi
203c2787 48
b21b0df6
MT
49if ! shopt -q login_shell ; then # We're not a login shell
50 # Need to redefine pathmunge, it get's undefined at the end of /etc/profile
51 pathmunge () {
52 case ":${PATH}:" in
53 *:"$1":*)
54 ;;
55 *)
56 if [ "$2" = "after" ] ; then
57 PATH=$PATH:$1
58 else
59 PATH=$1:$PATH
60 fi
61 esac
62 }
71e32384 63
b21b0df6
MT
64 # By default, we want umask to get set. This sets it for non-login shell.
65 # Current threshold for system reserved uid/gids is 200
66 # You could check uidgid reservation validity in
67 # /usr/share/doc/setup-*/uidgid file
68 if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
69 umask 002
70 else
71 umask 022
72 fi
71e32384 73
b21b0df6
MT
74 # Only display echos from profile.d scripts if we are no login shell
75 # and interactive - otherwise just process them to set envvars
76 for i in /etc/profile.d/*.sh; do
77 if [ -r "$i" ]; then
78 if [ "$PS1" ]; then
79 . "$i"
80 else
81 . "$i" >/dev/null
82 fi
83 fi
84 done
71e32384 85
b21b0df6
MT
86 unset i
87 unset -f pathmunge
88fi
89# vim:ts=4:sw=4