]> git.pld-linux.org Git - projects/setup.git/blobdiff - etc/profile
- added setting of xterm-window title for bash and zsh. TODO: ksh*
[projects/setup.git] / etc / profile
index b704f15f6205c0a09371ec5f764f91c24a795e49..3575dccc358ad2029cac71f3a127feb1c02e19f7 100644 (file)
@@ -4,8 +4,9 @@
 # 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
@@ -15,15 +16,18 @@ fi
 
 USER=`id -un`
 LOGNAME=$USER
-MAIL="/var/mail/$USER"
 
-HOSTNAME=`/bin/hostname`
+HOSTNAME=`/bin/uname -n`
 HISTFILE="$HOME/.history"
 HISTSIZE=1000
 HISTFILESIZE=1000
 
+# home_etc user config-dirs
+#CONFIG_DIR=etc
+#export CONFIG_DIR
+
 #
-# Setup the environment for varius shells
+# Setup the environment for various shells
 #
 
 if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
@@ -39,12 +43,21 @@ if [ "$SH" = "sh" ]; then
                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
@@ -98,11 +111,21 @@ case "$SH" in
                fi`]$ '
        fi
        PS2='> '
+       set -o nolog
        set -o emacs
-       trap 'case ${.sh.edchar} in  "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
+       case $TERM in
+       nxterm|xterm|xterm-color|rxvt)
+               trap 'case ${.sh.edchar} in  "\e[F") .sh.edchar="\ 5" ;; "\e[H") .sh.edchar="\ 1" ;; esac' KEYBD
+               ;;
+       linux)
+               trap 'case ${.sh.edchar} in  "\e[4~") .sh.edchar="\ 5" ;; "\e[1~") .sh.edchar="\ 1" ;; esac' KEYBD
+               ;;
+       esac
        ;;
   zsh)
        PS1='[%n@%m %~]%(!.#.%\$) '
+       RPS1="%T"
+       export RPS1
 
        # Setup key bindings
        bindkey -e >/dev/null 2>&1
@@ -121,6 +144,9 @@ case "$SH" in
                bindkey '^[[D' backward-char >/dev/null 2>&1
                bindkey '^[[C' forward-char >/dev/null 2>&1
                ;;
+       xterm*)
+               precmd () { print -Pn "\e]0;%n@%m: %~\a"i; }
+               ;;
        esac
        # other HISTFILE, zsh uses diffrent fmt
        HISTFILE=~/.historyz
This page took 0.065143 seconds and 4 git commands to generate.