# System wide environment and startup programs
# Functions and aliases go into the shells dependent startup files
-[ "`echo $PATH | grep -q /usr/X11R6/bin`" = "" ] && PATH="$PATH:/usr/X11R6/bin"
-[ "`echo $PATH | grep -q "$HOME/bin"`" = "" ] && PATH="$PATH:$HOME/bin"
+echo "$PATH" | grep -q /usr/X11R6/bin || PATH="$PATH:/usr/X11R6/bin"
+echo "$PATH" | grep -q /usr/local/bin || PATH="$PATH:/usr/local/bin"
+echo "$PATH" | grep -q "$HOME/bin" || PATH="$PATH:$HOME/bin"
if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
umask 002
USER=`id -un`
LOGNAME=$USER
-MAIL="/var/mail/$USER"
-HOSTNAME=`/bin/hostname`
+HOSTNAME=`/bin/uname -n`
HISTFILE="$HOME/.history"
HISTSIZE=1000
-HISTFILESIZE=1000
#
-# Setup the environment for varius shells
+# Setup the environment for various shells
#
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
- TERM=linux
+ TERM=linux
fi
SH="${0#\-}"
SH=zsh
elif [ -n "$BASH_VERSION" ]; then
SH=bash
+ elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
+ SH=ksh93
fi
fi
case "$SH" in
bash)
- PS1="[\u@\h \W]\\$ "
+ case $TERM in
+ xterm*)
+ PS1="\[\033]0;\u@\h: \w\007\][\u@\h \W]\\$ "
+ ;;
+ *)
+ PS1="[\u@\h \W]\\$ "
+ ;;
+ esac
;;
ksh|pdksh)
- if [ `id -u` -eq 0 ]; then
+ if [ `id -u` -eq 0 ]; then
PS1='[${LOGNAME-$USER}@${HOSTNAME} `
- if [ "$PWD" = "/${PWD##*/}" ]; then
- echo $PWD;
- else
- echo ${PWD##*/};
+ if [ "$PWD" = "/${PWD##*/}" ]; then
+ echo $PWD;
+ else
+ echo ${PWD##*/};
fi`]# '
else
PS1='[${LOGNAME-$USER}@${HOSTNAME} `
- if [ "$PWD" = "/${PWD##*/}" ]; then
- echo $PWD;
- else
- echo ${PWD##*/};
+ if [ "$PWD" = "/${PWD##*/}" ]; then
+ echo $PWD;
+ else
+ echo ${PWD##*/};
fi`]$ '
fi
PS2='> '
set -o emacs
- bind '^I'=complete >/dev/null 2>&1
bind '^[^I'=complete-list >/dev/null 2>&1
#
# Setup some of the most basic editing functions
- # to work properly under different termnal emulators.
+ # to work properly under different terminal emulators.
#
case $TERM in
- nxterm|xterm|xterm-color|rxvt)
+ nxterm|xterm|xterm-color)
bind '^[[H'=beginning-of-line >/dev/null 2>&1
bind '^[[F'=end-of-line >/dev/null 2>&1
;;
- linux)
- bind '^[1~'=beginning-of-line >/dev/null 2>&1
- bind '^[4~'=end-of-line >/dev/null 2>&1
+ linux|rxvt)
+ bind '^[[1~'=beginning-of-line >/dev/null 2>&1
+ bind '^[[4~'=end-of-line >/dev/null 2>&1
;;
esac
;;
ksh93)
- if [ `id -u` -eq 0 ]; then
+ if [ `id -u` -eq 0 ]; then
PS1='[${LOGNAME-$USER}@${HOSTNAME} `
- if [ "$PWD" = "/${PWD##*/}" ]; then
- echo $PWD;
- else
- echo ${PWD##*/};
+ if [ "$PWD" = "/${PWD##*/}" ]; then
+ echo $PWD;
+ else
+ echo ${PWD##*/};
fi`]# '
else
PS1='[${LOGNAME-$USER}@${HOSTNAME} `
- if [ "$PWD" = "/${PWD##*/}" ]; then
- echo $PWD;
- else
- echo ${PWD##*/};
+ if [ "$PWD" = "/${PWD##*/}" ]; then
+ echo $PWD;
+ else
+ echo ${PWD##*/};
fi`]$ '
fi
PS2='> '
+ set -o nolog
set -o emacs
+ case $TERM in
+ nxterm|xterm|xterm-color)
+ trap 'case ${.sh.edchar} in "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
+ ;;
+ linux|rxvt)
+ trap 'case ${.sh.edchar} in "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
+ ;;
+ esac
;;
zsh)
PS1='[%n@%m %~]%(!.#.%\$) '
+ RPS1="%T"
- # Setup key bindings
- bindkey -e >/dev/null 2>&1
- bindkey "^[[1~" beginning-of-line >/dev/null 2>&1
- bindkey "^[[H" beginning-of-line >/dev/null 2>&1
- bindkey "^[[4~" end-of-line >/dev/null 2>&1
- bindkey "^[[F" end-of-line >/dev/null 2>&1
- bindkey "^[[3~" delete-char >/dev/null 2>&1
- bindkey "^[[5~" history-search-backward >/dev/null 2>&1
- bindkey "^[[6~" history-search-forward >/dev/null 2>&1
-
- case "$TERM" in
- aterm)
- bindkey '^[[A' up-line-or-history >/dev/null 2>&1
- bindkey '^[[B' down-line-or-history >/dev/null 2>&1
- bindkey '^[[D' backward-char >/dev/null 2>&1
- bindkey '^[[C' forward-char >/dev/null 2>&1
- ;;
- esac
# other HISTFILE, zsh uses diffrent fmt
HISTFILE=~/.historyz
- # w/o this hist file wont get saved !
+ # w/o this hist file won't get saved!
SAVEHIST=$HISTSIZE
;;
esac
unset SH
-export PATH PS1 PS2 HOSTNAME HISTFILE HISTSIZE HISTFILESIZE USER LOGNAME MAIL
+export PATH USER LOGNAME HOSTNAME HISTFILE HISTSIZE PS1 PS2
+
+# Put all of the variables as files in /etc/env.d/
+# example:
+# cat /etc/env.d/VARIABLE
+# VARIABLE="value"
+for i in /etc/env.d/* ; do
+ NAME=`basename $i`
+ case $NAME in
+ *~ | *.bak | *.old | *.rpmnew | *.rpmsave )
+ # nothing
+ ;;
+ * )
+ if [ -r $i ]; then
+ . $i; export $NAME
+ fi
+ ;;
+ esac
+done
+# Scripts:
for i in /etc/profile.d/*.sh ; do
if [ -x $i ]; then
. $i