]> git.pld-linux.org Git - projects/setup.git/blame - etc/profile
- ugh, :set ff=unix
[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
fae754a5 20HOSTNAME=`/bin/uname -n`
9783a53d 21HISTFILE="$HOME/.history"
9bfefe38 22HISTSIZE=1000
23HISTFILESIZE=1000
99306191 24
d0a310e6
PG
25# home_etc user config-dirs
26#CONFIG_DIR=etc
27#export CONFIG_DIR
28
99306191 29#
33f77e8b 30# Setup the environment for various shells
99306191 31#
32
b62ea61b
JR
33if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
34 TERM=linux
35fi
36
9783a53d 37SH="${0#\-}"
65b2ff24 38SH="${SH#/bin/}"
558c4ec4 39if [ "$SH" = "sh" ]; then
516614fd 40 if [ -n "$KSH_VERSION" ]; then
9783a53d 41 SH=ksh
de30a7eb
AM
42 elif [ -n "$ZSH_VERSION" ]; then
43 SH=zsh
516614fd 44 elif [ -n "$BASH_VERSION" ]; then
9783a53d 45 SH=bash
8545780a
JR
46 elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
47 SH=ksh93
9783a53d
JR
48 fi
49fi
50
51case "$SH" in
99306191 52 bash)
516614fd 53 PS1="[\u@\h \W]\\$ "
99306191 54 ;;
55 ksh|pdksh)
8a243315
JR
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
99306191 71 PS2='> '
72 set -o emacs
47f173c9
JR
73 bind '^I'=complete >/dev/null 2>&1
74 bind '^[^I'=complete-list >/dev/null 2>&1
99306191 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)
47f173c9
JR
81 bind '^[[H'=beginning-of-line >/dev/null 2>&1
82 bind '^[[F'=end-of-line >/dev/null 2>&1
99306191 83 ;;
84 linux)
47f173c9
JR
85 bind '^[1~'=beginning-of-line >/dev/null 2>&1
86 bind '^[4~'=end-of-line >/dev/null 2>&1
99306191 87 ;;
88 esac
89 ;;
cc2c9e93
AM
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='> '
b429d9d3 107 set -o nolog
cc2c9e93 108 set -o emacs
ed7da3d6
JR
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
cc2c9e93 117 ;;
99306191 118 zsh)
de30a7eb 119 PS1='[%n@%m %~]%(!.#.%\$) '
06efe2f9
AM
120
121 # Setup key bindings
de30a7eb 122 bindkey -e >/dev/null 2>&1
06efe2f9
AM
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
99306191 143 ;;
144esac
145
9783a53d 146unset SH
0d8f7a70 147export PATH PS1 PS2 HOSTNAME HISTFILE HISTSIZE HISTFILESIZE USER LOGNAME MAIL
9bfefe38 148
149for i in /etc/profile.d/*.sh ; do
150 if [ -x $i ]; then
151 . $i
152 fi
153done
154
155unset i
06efe2f9
AM
156
157# vi:syntax=sh
This page took 1.659408 seconds and 4 git commands to generate.