]> git.pld-linux.org Git - projects/setup.git/blame_incremental - etc/profile
- $SHELL is set once for session, back to $0
[projects/setup.git] / etc / profile
... / ...
CommitLineData
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
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"
10
11if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
12 umask 002
13else
14 umask 022
15fi
16
17USER=`id -un`
18LOGNAME=$USER
19
20HOSTNAME=`/bin/uname -n`
21HISTFILE="$HOME/.history"
22HISTSIZE=1000
23
24#
25# Setup the environment for various shells
26#
27
28if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
29 TERM=linux
30fi
31
32SH="${0#\-}"
33SH="${SH#/bin/}"
34if [ "$SH" = "sh" ]; then
35 if [ -n "$KSH_VERSION" ]; then
36 SH=ksh
37 elif [ -n "$ZSH_VERSION" ]; then
38 SH=zsh
39 elif [ -n "$BASH_VERSION" ]; then
40 SH=bash
41 elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
42 SH=ksh93
43 fi
44fi
45
46case "$SH" in
47 bash)
48 case $TERM in
49 xterm*)
50 PS1="\[\033]0;\u@\h: \w\007\][\u@\h \W]\\$ "
51 ;;
52 *)
53 PS1="[\u@\h \W]\\$ "
54 ;;
55 esac
56 ;;
57 ksh|pdksh)
58 if [ `id -u` -eq 0 ]; then
59 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
60 if [ "$PWD" = "/${PWD##*/}" ]; then
61 echo $PWD;
62 else
63 echo ${PWD##*/};
64 fi`]# '
65 else
66 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
67 if [ "$PWD" = "/${PWD##*/}" ]; then
68 echo $PWD;
69 else
70 echo ${PWD##*/};
71 fi`]$ '
72 fi
73 PS2='> '
74 set -o emacs
75 bind '^I'=complete >/dev/null 2>&1
76 bind '^[^I'=complete-list >/dev/null 2>&1
77 #
78 # Setup some of the most basic editing functions
79 # to work properly under different terminal emulators.
80 #
81 case $TERM in
82 nxterm|xterm|xterm-color)
83 bind '^[[H'=beginning-of-line >/dev/null 2>&1
84 bind '^[[F'=end-of-line >/dev/null 2>&1
85 ;;
86 linux|rxvt)
87 bind '^[[1~'=beginning-of-line >/dev/null 2>&1
88 bind '^[[4~'=end-of-line >/dev/null 2>&1
89 ;;
90 esac
91 ;;
92 ksh93)
93 if [ `id -u` -eq 0 ]; then
94 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
95 if [ "$PWD" = "/${PWD##*/}" ]; then
96 echo $PWD;
97 else
98 echo ${PWD##*/};
99 fi`]# '
100 else
101 PS1='[${LOGNAME-$USER}@${HOSTNAME} `
102 if [ "$PWD" = "/${PWD##*/}" ]; then
103 echo $PWD;
104 else
105 echo ${PWD##*/};
106 fi`]$ '
107 fi
108 PS2='> '
109 set -o nolog
110 set -o emacs
111 case $TERM in
112 nxterm|xterm|xterm-color)
113 trap 'case ${.sh.edchar} in "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
114 ;;
115 linux|rxvt)
116 trap 'case ${.sh.edchar} in "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
117 ;;
118 esac
119 ;;
120 zsh)
121 PS1='[%n@%m %~]%(!.#.%\$) '
122 RPS1="%T"
123
124 # other HISTFILE, zsh uses diffrent fmt
125 HISTFILE=~/.historyz
126 # w/o this hist file won't get saved!
127 SAVEHIST=$HISTSIZE
128 ;;
129esac
130
131unset SH
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
151
152# Scripts:
153for i in /etc/profile.d/*.sh ; do
154 if [ -x $i ]; then
155 . $i
156 fi
157done
158
159unset i
160
161# vi:syntax=sh
This page took 0.040651 seconds and 4 git commands to generate.