]> git.pld-linux.org Git - projects/setup.git/blob - etc/profile
- Do not export MAIL while isn't set here
[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 #HOME_ETC=$HOME/$CONFIG_DIR
28 #export CONFIG_DIR HOME_ETC
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         case $TERM in
55                 xterm*)
56                         PS1="\[\033]0;\u@\h: \w\007\][\u@\h \W]\\$ "
57                         ;;
58                 *)
59                         PS1="[\u@\h \W]\\$ "
60                         ;;
61         esac
62         ;;
63   ksh|pdksh)
64         if [ `id -u` -eq 0 ]; then
65                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
66                 if [ "$PWD" = "/${PWD##*/}" ]; then
67                         echo $PWD;
68                 else
69                         echo ${PWD##*/};
70                 fi`]# '
71         else
72                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
73                 if [ "$PWD" = "/${PWD##*/}" ]; then
74                         echo $PWD;
75                 else
76                         echo ${PWD##*/};
77                 fi`]$ '
78         fi
79         PS2='> '
80         set -o emacs
81         bind '^[^I'=complete-list >/dev/null 2>&1
82         #
83         # Setup some of the most basic editing functions
84         # to work properly under different terminal emulators.
85         #
86         case $TERM in
87         nxterm|xterm|xterm-color)
88                 bind '^[[H'=beginning-of-line >/dev/null 2>&1
89                 bind '^[[F'=end-of-line >/dev/null 2>&1
90                 ;;
91         linux|rxvt)
92                 bind '^[[1~'=beginning-of-line >/dev/null 2>&1
93                 bind '^[[4~'=end-of-line >/dev/null 2>&1
94                 ;;
95         esac
96         ;;
97   ksh93)
98         if [ `id -u` -eq 0 ]; then
99                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
100                 if [ "$PWD" = "/${PWD##*/}" ]; then
101                         echo $PWD;
102                 else
103                         echo ${PWD##*/};
104                 fi`]# '
105         else
106                 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
107                 if [ "$PWD" = "/${PWD##*/}" ]; then
108                         echo $PWD;
109                 else
110                         echo ${PWD##*/};
111                 fi`]$ '
112         fi
113         PS2='> '
114         set -o nolog
115         set -o emacs
116         case $TERM in
117         nxterm|xterm|xterm-color)
118                 trap 'case ${.sh.edchar} in "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
119                 ;;
120         linux|rxvt)
121                 trap 'case ${.sh.edchar} in "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
122                 ;;
123         esac
124         ;;
125   zsh)
126         PS1='[%n@%m %~]%(!.#.%\$) '
127         RPS1="%T"
128
129         # other HISTFILE, zsh uses diffrent fmt
130         HISTFILE=~/.historyz
131         # w/o this hist file won't get saved!
132         SAVEHIST=$HISTSIZE
133         ;;
134 esac
135
136 unset SH
137 export PATH USER LOGNAME HOSTNAME HISTFILE HISTSIZE HISTFILESIZE PS1 PS2
138
139 for i in /etc/profile.d/*.sh ; do
140         if [ -x $i ]; then
141                 . $i
142         fi
143 done
144
145 unset i
146
147 # vi:syntax=sh
This page took 0.063077 seconds and 4 git commands to generate.