X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=etc%2Fprofile;h=61e83e5c9c18dbea4ce9fa7d37c18c3ffa340ef3;hb=ed7da3d67b48b76afe315a8178fadb3853282136;hp=417807d1434883b67258c37c2932e257b8e80d36;hpb=993061910e068374d76f3ba1333f6d16a625fe14;p=projects%2Fsetup.git diff --git a/etc/profile b/etc/profile index 417807d..61e83e5 100644 --- a/etc/profile +++ b/etc/profile @@ -1,21 +1,24 @@ # /etc/profile +# $Id$ # System wide environment and startup programs # Functions and aliases go into the shells dependent startup files -PATH="$PATH:/usr/X11R6/bin" +[ "`echo $PATH | grep -q /usr/X11R6/bin`" = "" ] && PATH="$PATH:/usr/X11R6/bin" +[ "`echo $PATH | grep -q "$HOME/bin"`" = "" ] && PATH="$PATH:$HOME/bin" if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then - umask 007 + umask 002 else - umask 077 + umask 022 fi USER=`id -un` LOGNAME=$USER -MAIL="/var/spool/mail/$USER" +MAIL="/var/mail/$USER" HOSTNAME=`/bin/hostname` +HISTFILE="$HOME/.history" HISTSIZE=1000 HISTFILESIZE=1000 @@ -23,44 +26,119 @@ HISTFILESIZE=1000 # Setup the environment for varius shells # -case "${0#\-}" in - ash) - PS1="${HOSTNAME}\$ " - ;; +if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then + TERM=linux +fi + +SH="${0#\-}" +SH="${SH#/bin/}" +if [ "$SH" = "sh" ]; then + if [ -n "$KSH_VERSION" ]; then + SH=ksh + elif [ -n "$ZSH_VERSION" ]; then + SH=zsh + elif [ -n "$BASH_VERSION" ]; then + SH=bash + fi +fi + +case "$SH" in bash) - PS1="\u@\h \W\\$ " + PS1="[\u@\h \W]\\$ " ;; ksh|pdksh) - PS1='[${LOGNAME-$USER}@${HOSTNAME}` - if [ "$PWD" = "${PWD##$HOME}" ]; then - echo $PWD; - else - echo '~'${PWD##$HOME}; - fi`] '$PS1 + if [ `id -u` -eq 0 ]; then + PS1='[${LOGNAME-$USER}@${HOSTNAME} ` + if [ "$PWD" = "/${PWD##*/}" ]; then + echo $PWD; + else + echo ${PWD##*/}; + fi`]# ' + else + PS1='[${LOGNAME-$USER}@${HOSTNAME} ` + if [ "$PWD" = "/${PWD##*/}" ]; then + echo $PWD; + else + echo ${PWD##*/}; + fi`]$ ' + fi PS2='> ' set -o emacs - bind '^I'=complete + 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. # case $TERM in nxterm|xterm|xterm-color|rxvt) - bind '^[[H'=beginning-of-line - bind '^[[F'=end-of-line + 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 + ;; + esac + ;; + ksh93) + if [ `id -u` -eq 0 ]; then + PS1='[${LOGNAME-$USER}@${HOSTNAME} ` + if [ "$PWD" = "/${PWD##*/}" ]; then + echo $PWD; + else + echo ${PWD##*/}; + fi`]# ' + else + PS1='[${LOGNAME-$USER}@${HOSTNAME} ` + 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|rxvt) + trap 'case ${.sh.edchar} in "") .sh.edchar="" ;; "") .sh.edchar="" ;; esac' KEYBD ;; linux) - bind '^[1~'=beginning-of-line - bind '^[4~'=end-of-line + trap 'case ${.sh.edchar} in "[4~") .sh.edchar="" ;; "[1~") .sh.edchar="" ;; esac' KEYBD ;; esac ;; zsh) - PS1="%m:%~%# " + PS1='[%n@%m %~]%(!.#.%\$) ' + + # 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 ! + SAVEHIST=$HISTSIZE ;; esac -export PATH PS1 PS2 HOSTNAME HISTSIZE HISTFILESIZE USER LOGNAME MAIL +unset SH +export PATH PS1 PS2 HOSTNAME HISTFILE HISTSIZE HISTFILESIZE USER LOGNAME MAIL for i in /etc/profile.d/*.sh ; do if [ -x $i ]; then @@ -69,3 +147,5 @@ for i in /etc/profile.d/*.sh ; do done unset i + +# vi:syntax=sh