]> git.pld-linux.org Git - projects/setup.git/blob - etc/profile
- removed IRCSERVER (this should be in /etc/profile.d instead, provided by packages...
[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 HISTFILESIZE=1000
24
25 # home_etc user config-dirs
26 #CONFIG_DIR=etc
27 #export CONFIG_DIR
28
29 #
30 # Setup the environment for various shells
31 #
32
33 if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
34  TERM=linux
35 fi
36
37 SH="${0#\-}"
38 SH="${SH#/bin/}"
39 if [ "$SH" = "sh" ]; then
40         if [ -n "$KSH_VERSION" ]; then
41                 SH=ksh
42         elif [ -n "$ZSH_VERSION" ]; then
43                 SH=zsh
44         elif [ -n "$BASH_VERSION" ]; then
45                 SH=bash
46         elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
47                 SH=ksh93
48         fi
49 fi
50
51 case "$SH" in
52   bash)
53         PS1="[\u@\h \W]\\$ "
54         ;;
55   ksh|pdksh)
56         if [ `id -u` -eq 0 ]; then
57                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
58                         if [ "$PWD" = "/${PWD##*/}" ]; then
59                                 echo $PWD;
60                         else
61                                 echo ${PWD##*/};
62                 fi`]# '
63         else
64                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
65                         if [ "$PWD" = "/${PWD##*/}" ]; then
66                                 echo $PWD;
67                         else
68                                 echo ${PWD##*/};
69                 fi`]$ '
70         fi
71         PS2='> '
72         set -o emacs
73         bind '^I'=complete >/dev/null 2>&1
74         bind '^[^I'=complete-list >/dev/null 2>&1
75         #
76         # Setup some of the most basic editing functions
77         # to work properly under different termnal emulators.
78         #
79         case $TERM in
80         nxterm|xterm|xterm-color|rxvt)
81                 bind '^[[H'=beginning-of-line >/dev/null 2>&1
82                 bind '^[[F'=end-of-line >/dev/null 2>&1
83                 ;;
84         linux)
85                 bind '^[1~'=beginning-of-line >/dev/null 2>&1
86                 bind '^[4~'=end-of-line >/dev/null 2>&1
87                 ;;
88         esac
89         ;;
90   ksh93)
91         if [ `id -u` -eq 0 ]; then
92                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
93                         if [ "$PWD" = "/${PWD##*/}" ]; then
94                                 echo $PWD;
95                         else
96                                 echo ${PWD##*/};
97                 fi`]# '
98         else
99                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
100                         if [ "$PWD" = "/${PWD##*/}" ]; then
101                                 echo $PWD;
102                         else
103                                 echo ${PWD##*/};
104                 fi`]$ '
105         fi
106         PS2='> '
107         set -o nolog
108         set -o emacs
109         case $TERM in
110         nxterm|xterm|xterm-color|rxvt)
111                 trap 'case ${.sh.edchar} in  "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
112                 ;;
113         linux)
114                 trap 'case ${.sh.edchar} in  "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
115                 ;;
116         esac
117         ;;
118   zsh)
119         PS1='[%n@%m %~]%(!.#.%\$) '
120
121         # Setup key bindings
122         bindkey -e >/dev/null 2>&1
123         bindkey "^[[1~" beginning-of-line >/dev/null 2>&1
124         bindkey "^[[H" beginning-of-line >/dev/null 2>&1
125         bindkey "^[[4~" end-of-line >/dev/null 2>&1
126         bindkey "^[[F" end-of-line >/dev/null 2>&1
127         bindkey "^[[3~" delete-char >/dev/null 2>&1
128         bindkey "^[[5~" history-search-backward >/dev/null 2>&1
129         bindkey "^[[6~" history-search-forward >/dev/null 2>&1
130
131         case "$TERM" in
132         aterm)
133                 bindkey '^[[A' up-line-or-history >/dev/null 2>&1
134                 bindkey '^[[B' down-line-or-history >/dev/null 2>&1
135                 bindkey '^[[D' backward-char >/dev/null 2>&1
136                 bindkey '^[[C' forward-char >/dev/null 2>&1
137                 ;;
138         esac
139         # other HISTFILE, zsh uses diffrent fmt
140         HISTFILE=~/.historyz
141         # w/o this hist file wont get saved !
142         SAVEHIST=$HISTSIZE
143         ;;
144 esac
145
146 unset SH
147 export PATH PS1 PS2 HOSTNAME HISTFILE HISTSIZE HISTFILESIZE USER LOGNAME MAIL
148
149 for i in /etc/profile.d/*.sh ; do
150         if [ -x $i ]; then
151                 . $i
152         fi
153 done
154
155 unset i
156
157 # vi:syntax=sh
This page took 0.035022 seconds and 4 git commands to generate.