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