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