]> git.pld-linux.org Git - projects/setup.git/blame - etc/profile
- one more group for grsec
[projects/setup.git] / etc / profile
CommitLineData
9bfefe38 1# /etc/profile
06efe2f9 2# $Id$
9bfefe38 3
4# System wide environment and startup programs
99306191 5# Functions and aliases go into the shells dependent startup files
9bfefe38 6
220f9fb6
SZ
7echo "$PATH" | grep -q /usr/X11R6/bin || PATH="$PATH:/usr/X11R6/bin"
8echo "$PATH" | grep -q /usr/local/bin || PATH="$PATH:/usr/local/bin"
9echo "$PATH" | grep -q "$HOME/bin" || PATH="$PATH:$HOME/bin"
9bfefe38 10
9bfefe38 11if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
b62ea61b 12 umask 002
9bfefe38 13else
b62ea61b 14 umask 022
9bfefe38 15fi
16
17USER=`id -un`
18LOGNAME=$USER
9bfefe38 19
20HOSTNAME=`/bin/hostname`
9783a53d 21HISTFILE="$HOME/.history"
9bfefe38 22HISTSIZE=1000
23HISTFILESIZE=1000
99306191 24
25#
33f77e8b 26# Setup the environment for various shells
99306191 27#
28
b62ea61b
JR
29if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
30 TERM=linux
31fi
32
9783a53d 33SH="${0#\-}"
65b2ff24 34SH="${SH#/bin/}"
558c4ec4 35if [ "$SH" = "sh" ]; then
516614fd 36 if [ -n "$KSH_VERSION" ]; then
9783a53d 37 SH=ksh
de30a7eb
AM
38 elif [ -n "$ZSH_VERSION" ]; then
39 SH=zsh
516614fd 40 elif [ -n "$BASH_VERSION" ]; then
9783a53d 41 SH=bash
8545780a
JR
42 elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
43 SH=ksh93
9783a53d
JR
44 fi
45fi
46
47case "$SH" in
99306191 48 bash)
516614fd 49 PS1="[\u@\h \W]\\$ "
99306191 50 ;;
51 ksh|pdksh)
8a243315
JR
52 if [ `id -u` -eq 0 ]; then
53 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
54 if [ "$PWD" = "/${PWD##*/}" ]; then
55 echo $PWD;
56 else
57 echo ${PWD##*/};
58 fi`]# '
59 else
60 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
61 if [ "$PWD" = "/${PWD##*/}" ]; then
62 echo $PWD;
63 else
64 echo ${PWD##*/};
65 fi`]$ '
66 fi
99306191 67 PS2='> '
68 set -o emacs
47f173c9
JR
69 bind '^I'=complete >/dev/null 2>&1
70 bind '^[^I'=complete-list >/dev/null 2>&1
99306191 71 #
72 # Setup some of the most basic editing functions
73 # to work properly under different termnal emulators.
74 #
75 case $TERM in
76 nxterm|xterm|xterm-color|rxvt)
47f173c9
JR
77 bind '^[[H'=beginning-of-line >/dev/null 2>&1
78 bind '^[[F'=end-of-line >/dev/null 2>&1
99306191 79 ;;
80 linux)
47f173c9
JR
81 bind '^[1~'=beginning-of-line >/dev/null 2>&1
82 bind '^[4~'=end-of-line >/dev/null 2>&1
99306191 83 ;;
84 esac
85 ;;
cc2c9e93
AM
86 ksh93)
87 if [ `id -u` -eq 0 ]; then
88 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
89 if [ "$PWD" = "/${PWD##*/}" ]; then
90 echo $PWD;
91 else
92 echo ${PWD##*/};
93 fi`]# '
94 else
95 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
96 if [ "$PWD" = "/${PWD##*/}" ]; then
97 echo $PWD;
98 else
99 echo ${PWD##*/};
100 fi`]$ '
101 fi
102 PS2='> '
b429d9d3 103 set -o nolog
cc2c9e93 104 set -o emacs
ed7da3d6
JR
105 case $TERM in
106 nxterm|xterm|xterm-color|rxvt)
107 trap 'case ${.sh.edchar} in "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
108 ;;
109 linux)
110 trap 'case ${.sh.edchar} in "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
111 ;;
112 esac
cc2c9e93 113 ;;
99306191 114 zsh)
de30a7eb 115 PS1='[%n@%m %~]%(!.#.%\$) '
06efe2f9
AM
116
117 # Setup key bindings
de30a7eb 118 bindkey -e >/dev/null 2>&1
06efe2f9
AM
119 bindkey "^[[1~" beginning-of-line >/dev/null 2>&1
120 bindkey "^[[H" beginning-of-line >/dev/null 2>&1
121 bindkey "^[[4~" end-of-line >/dev/null 2>&1
122 bindkey "^[[F" end-of-line >/dev/null 2>&1
123 bindkey "^[[3~" delete-char >/dev/null 2>&1
124 bindkey "^[[5~" history-search-backward >/dev/null 2>&1
125 bindkey "^[[6~" history-search-forward >/dev/null 2>&1
126
127 case "$TERM" in
128 aterm)
129 bindkey '^[[A' up-line-or-history >/dev/null 2>&1
130 bindkey '^[[B' down-line-or-history >/dev/null 2>&1
131 bindkey '^[[D' backward-char >/dev/null 2>&1
132 bindkey '^[[C' forward-char >/dev/null 2>&1
133 ;;
134 esac
135 # other HISTFILE, zsh uses diffrent fmt
136 HISTFILE=~/.historyz
137 # w/o this hist file wont get saved !
138 SAVEHIST=$HISTSIZE
99306191 139 ;;
140esac
141
9783a53d
JR
142unset SH
143export PATH PS1 PS2 HOSTNAME HISTFILE HISTSIZE HISTFILESIZE USER LOGNAME MAIL
9bfefe38 144
145for i in /etc/profile.d/*.sh ; do
146 if [ -x $i ]; then
147 . $i
148 fi
149done
150
151unset i
06efe2f9
AM
152
153# vi:syntax=sh
This page took 0.112573 seconds and 4 git commands to generate.