]> git.pld-linux.org Git - projects/setup.git/blob - etc/profile
- remove RPS1
[projects/setup.git] / etc / profile
1 # /etc/profile
2 # $Id$
3
4 # System wide environment and startup programs
5 # Functions and aliases go into the shells dependent startup files
6
7 echo "$PATH" | grep -q /usr/X11R6/bin || PATH="$PATH:/usr/X11R6/bin"
8 echo "$PATH" | grep -q /usr/local/bin || PATH="$PATH:/usr/local/bin"
9 echo "$PATH" | grep -q "$HOME/bin" || PATH="$PATH:$HOME/bin"
10
11 if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
12         umask 002
13 else
14         umask 022
15 fi
16
17 USER=`id -un`
18 LOGNAME=$USER
19
20 HOSTNAME=`/bin/uname -n`
21 HISTFILE="$HOME/.history"
22 HISTSIZE=1000
23
24 #
25 # Setup the environment for various shells
26 #
27
28 if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
29         TERM=linux
30 fi
31
32 SH="${0#\-}"
33 SH="${SH#/bin/}"
34 if [ "$SH" = "sh" ]; then
35         if [ -n "$KSH_VERSION" ]; then
36                 SH=ksh
37         elif [ -n "$ZSH_VERSION" ]; then
38                 SH=zsh
39         elif [ -n "$BASH_VERSION" ]; then
40                 SH=bash
41         elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
42                 SH=ksh93
43         fi
44 fi
45
46 case "$SH" in
47   bash)
48         case $TERM in
49                 xterm*)
50                         PS1="\[\033]0;\u@\h: \w\007\][\u@\h \W]\\$ "
51                         ;;
52                 *)
53                         PS1="[\u@\h \W]\\$ "
54                         ;;
55         esac
56         ;;
57   ksh|pdksh)
58         if [ `id -u` -eq 0 ]; then
59                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
60                 if [ "$PWD" = "/${PWD##*/}" ]; then
61                         echo $PWD;
62                 else
63                         echo ${PWD##*/};
64                 fi`]# '
65         else
66                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
67                 if [ "$PWD" = "/${PWD##*/}" ]; then
68                         echo $PWD;
69                 else
70                         echo ${PWD##*/};
71                 fi`]$ '
72         fi
73         PS2='> '
74         set -o emacs
75         bind '^I'=complete >/dev/null 2>&1
76         bind '^[^I'=complete-list >/dev/null 2>&1
77         #
78         # Setup some of the most basic editing functions
79         # to work properly under different terminal emulators.
80         #
81         case $TERM in
82         nxterm|xterm|xterm-color)
83                 bind '^[[H'=beginning-of-line >/dev/null 2>&1
84                 bind '^[[F'=end-of-line >/dev/null 2>&1
85                 ;;
86         linux|rxvt)
87                 bind '^[[1~'=beginning-of-line >/dev/null 2>&1
88                 bind '^[[4~'=end-of-line >/dev/null 2>&1
89                 ;;
90         esac
91         ;;
92   ksh93)
93         if [ `id -u` -eq 0 ]; then
94                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
95                 if [ "$PWD" = "/${PWD##*/}" ]; then
96                         echo $PWD;
97                 else
98                         echo ${PWD##*/};
99                 fi`]# '
100         else
101                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
102                 if [ "$PWD" = "/${PWD##*/}" ]; then
103                         echo $PWD;
104                 else
105                         echo ${PWD##*/};
106                 fi`]$ '
107         fi
108         PS2='> '
109         set -o nolog
110         set -o emacs
111         case $TERM in
112         nxterm|xterm|xterm-color)
113                 trap 'case ${.sh.edchar} in "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
114                 ;;
115         linux|rxvt)
116                 trap 'case ${.sh.edchar} in "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
117                 ;;
118         esac
119         ;;
120   zsh)
121         PS1='[%n@%m %~]%(!.#.%\$) '
122
123         # other HISTFILE, zsh uses diffrent fmt
124         HISTFILE=~/.historyz
125         # w/o this hist file won't get saved!
126         SAVEHIST=$HISTSIZE
127         ;;
128 esac
129
130 unset SH
131 export PATH USER LOGNAME HOSTNAME HISTFILE HISTSIZE PS1 PS2
132
133 # Put all of the variables as files in /etc/env.d/
134 # example:
135 # cat /etc/env.d/VARIABLE
136 # VARIABLE="value"
137 for i in /etc/env.d/* ; do
138         NAME=`basename $i`
139         case $NAME in
140                 *~ | *.bak | *.old | *.rpmnew | *.rpmsave )
141                         # nothing
142                         ;;
143                 * )
144                         if [ -r $i ]; then
145                                 . $i; export $NAME
146                         fi
147                         ;;
148         esac
149 done
150
151 # Scripts:
152 for i in /etc/profile.d/*.sh ; do
153         . $i
154 done
155
156 unset i
157
158 # vi:syntax=sh
This page took 0.068524 seconds and 3 git commands to generate.