]> git.pld-linux.org Git - projects/setup.git/blame - etc/profile
- ChangeLog update by changelog.sh
[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
2ad8899a
TP
27#HOME_ETC=$HOME/$CONFIG_DIR
28#export CONFIG_DIR HOME_ETC
d0a310e6 29
99306191 30#
33f77e8b 31# Setup the environment for various shells
99306191 32#
33
b62ea61b 34if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
e38f3853 35 TERM=linux
b62ea61b
JR
36fi
37
9783a53d 38SH="${0#\-}"
65b2ff24 39SH="${SH#/bin/}"
558c4ec4 40if [ "$SH" = "sh" ]; then
516614fd 41 if [ -n "$KSH_VERSION" ]; then
9783a53d 42 SH=ksh
de30a7eb
AM
43 elif [ -n "$ZSH_VERSION" ]; then
44 SH=zsh
516614fd 45 elif [ -n "$BASH_VERSION" ]; then
9783a53d 46 SH=bash
8545780a
JR
47 elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
48 SH=ksh93
9783a53d
JR
49 fi
50fi
51
52case "$SH" in
99306191 53 bash)
e38f3853 54 case $TERM in
b90e08ad
PG
55 xterm*)
56 PS1="\[\033]0;\u@\h: \w\007\][\u@\h \W]\\$ "
57 ;;
58 *)
59 PS1="[\u@\h \W]\\$ "
60 ;;
61 esac
99306191 62 ;;
63 ksh|pdksh)
e38f3853 64 if [ `id -u` -eq 0 ]; then
8a243315 65 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
e38f3853
TP
66 if [ "$PWD" = "/${PWD##*/}" ]; then
67 echo $PWD;
68 else
69 echo ${PWD##*/};
8a243315
JR
70 fi`]# '
71 else
72 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
e38f3853
TP
73 if [ "$PWD" = "/${PWD##*/}" ]; then
74 echo $PWD;
75 else
76 echo ${PWD##*/};
8a243315
JR
77 fi`]$ '
78 fi
99306191 79 PS2='> '
80 set -o emacs
47f173c9 81 bind '^[^I'=complete-list >/dev/null 2>&1
99306191 82 #
83 # Setup some of the most basic editing functions
18eba2f7 84 # to work properly under different terminal emulators.
99306191 85 #
86 case $TERM in
18eba2f7 87 nxterm|xterm|xterm-color)
47f173c9
JR
88 bind '^[[H'=beginning-of-line >/dev/null 2>&1
89 bind '^[[F'=end-of-line >/dev/null 2>&1
99306191 90 ;;
18eba2f7 91 linux|rxvt)
92 bind '^[[1~'=beginning-of-line >/dev/null 2>&1
93 bind '^[[4~'=end-of-line >/dev/null 2>&1
99306191 94 ;;
95 esac
96 ;;
cc2c9e93 97 ksh93)
e38f3853 98 if [ `id -u` -eq 0 ]; then
cc2c9e93 99 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
e38f3853
TP
100 if [ "$PWD" = "/${PWD##*/}" ]; then
101 echo $PWD;
102 else
103 echo ${PWD##*/};
cc2c9e93
AM
104 fi`]# '
105 else
106 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
e38f3853
TP
107 if [ "$PWD" = "/${PWD##*/}" ]; then
108 echo $PWD;
109 else
110 echo ${PWD##*/};
cc2c9e93
AM
111 fi`]$ '
112 fi
113 PS2='> '
b429d9d3 114 set -o nolog
cc2c9e93 115 set -o emacs
ed7da3d6 116 case $TERM in
18eba2f7 117 nxterm|xterm|xterm-color)
e38f3853 118 trap 'case ${.sh.edchar} in "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
ed7da3d6 119 ;;
18eba2f7 120 linux|rxvt)
e38f3853 121 trap 'case ${.sh.edchar} in "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
ed7da3d6
JR
122 ;;
123 esac
cc2c9e93 124 ;;
99306191 125 zsh)
de30a7eb 126 PS1='[%n@%m %~]%(!.#.%\$) '
2ad8899a 127 RPS1="%T"
06efe2f9 128
06efe2f9
AM
129 # other HISTFILE, zsh uses diffrent fmt
130 HISTFILE=~/.historyz
e38f3853 131 # w/o this hist file won't get saved!
06efe2f9 132 SAVEHIST=$HISTSIZE
99306191 133 ;;
134esac
135
9783a53d 136unset SH
d054d41a 137export PATH USER LOGNAME HOSTNAME HISTFILE HISTSIZE HISTFILESIZE PS1 PS2
9bfefe38 138
139for i in /etc/profile.d/*.sh ; do
140 if [ -x $i ]; then
141 . $i
142 fi
143done
144
145unset i
06efe2f9
AM
146
147# vi:syntax=sh
This page took 0.058291 seconds and 4 git commands to generate.