]>
Commit | Line | Data |
---|---|---|
1 | # Begin /etc/profile | |
2 | # Written for Beyond Linux From Scratch | |
3 | # by James Robertson <jameswrobertson@earthlink.net> | |
4 | # modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg> | |
5 | ||
6 | # System wide environment variables and startup programs. | |
7 | ||
8 | # System wide aliases and functions should go in /etc/bashrc. Personal | |
9 | # environment variables and startup programs should go into | |
10 | # ~/.bash_profile. Personal aliases and functions should go into | |
11 | # ~/.bashrc. | |
12 | ||
13 | # Functions to help us manage paths. Second argument is the name of the | |
14 | # path variable to be modified (default: PATH) | |
15 | pathremove () { | |
16 | local IFS=':' | |
17 | local NEWPATH | |
18 | local DIR | |
19 | local PATHVARIABLE=${2:-PATH} | |
20 | for DIR in ${!PATHVARIABLE} ; do | |
21 | if [ "$DIR" != "$1" ] ; then | |
22 | NEWPATH=${NEWPATH:+$NEWPATH:}$DIR | |
23 | fi | |
24 | done | |
25 | export $PATHVARIABLE="$NEWPATH" | |
26 | } | |
27 | ||
28 | pathprepend () { | |
29 | pathremove $1 $2 | |
30 | local PATHVARIABLE=${2:-PATH} | |
31 | export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}" | |
32 | } | |
33 | ||
34 | pathappend () { | |
35 | pathremove $1 $2 | |
36 | local PATHVARIABLE=${2:-PATH} | |
37 | export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1" | |
38 | } | |
39 | ||
40 | ||
41 | # Set the initial path | |
42 | export PATH=/bin:/usr/bin | |
43 | ||
44 | if [ $EUID -eq 0 ] ; then | |
45 | pathappend /sbin:/usr/sbin | |
46 | unset HISTFILE | |
47 | fi | |
48 | ||
49 | # Setup some environment variables. | |
50 | export HISTSIZE=1000 | |
51 | export HISTIGNORE="&:[bf]g:exit" | |
52 | export PS1="[\u@\h \w]\\$ " | |
53 | #export PS1='\u@\h:\w\$ ' | |
54 | ||
55 | for script in /etc/profile.d/*.sh ; do | |
56 | if [ -r $script ] ; then | |
57 | . $script | |
58 | fi | |
59 | done | |
60 | ||
61 | # Now to clean up | |
62 | unset pathremove pathprepend pathappend | |
63 | ||
64 | # End /etc/profile |