diff rc/bash @ 258:0cd601956a9a

Merge.
author Edho Arief <edho@myconan.net>
date Sun, 20 Nov 2011 23:21:45 +0700
parents adcea08f6807
children 6bdfe1746bb1
line wrap: on
line diff
--- a/rc/bash	Sun Nov 20 23:21:19 2011 +0700
+++ b/rc/bash	Sun Nov 20 23:21:45 2011 +0700
@@ -16,14 +16,10 @@
 _org_path="${PATH}"
 export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 
-case "${TERM}" in
-  xterm*|dtterm*|screen*)
-    PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ '
-  ;;
-  *)
-    PS1='[\u@\h \W]\$ '
-  ;;
-esac
+# Custom application I usually install and safe to prioritize
+for i in {"${HOME}/app","/opt"}/{tmux,ruby19,node,tarsnap,symon,nginx}/{bin,sbin}; do
+  [ -d "${i}" ] && PATH="${i}:${PATH}"
+done
 
 shopt -s histappend
 PROMPT_COMMAND='history -a'
@@ -57,12 +53,13 @@
     [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
     [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y
     [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y
-    [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}"
-    [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}"
-    [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}"
-    [ -d /usr/sfw/bin ] && PATH="${PATH}:/usr/sfw/bin"
-    [ -d /usr/xpg4/bin ] && PATH="${PATH}:/usr/xpg4/bin"
-    export PATH
+    # Higher priority directories
+    for i in {/opt/csw,/usr/gnu}/{,s}bin; do
+      [ -d "${i}" ] && PATH="${i}:${PATH}"
+    done
+    for i in /usr/{sfw,xpg4}/bin; do
+      [ -d "${i}" ] && PATH="${PATH}:${i}"
+    done
     alias ping="ping -s"
     alias ping6="ping -A inet6"
   ;;
@@ -72,6 +69,7 @@
     export LSCOLORS=ExGxFxdxCxegedabagExEx
   ;;
   OpenBSD)
+    PATH="${PATH}:/usr/X11R6/bin"
     if command -v gls > /dev/null 2>&1; then
       _has_gnu_ls=y
       _ls="gls"
@@ -82,7 +80,7 @@
     fi
   ;;
   NetBSD)
-    export PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin"
+    PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin"
     if command -v gls > /dev/null 2>&1; then
       _has_gnu_ls=y
       _ls="gls"
@@ -108,8 +106,12 @@
 
 
 case "${TERM}" in
-  xterm*|screen*|dtterm)
-    PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007";'"${PROMPT_COMMAND}"
+  xterm*|screen*|dtterm*)
+    PROMPT_COMMAND='echo -ne "\033]0;'"$(id -un)@$(uname -n)"': ${PWD}\007";'"${PROMPT_COMMAND}"
+    PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ '
+  ;;
+  *)
+    PS1='[\u@\h \W]\$ '
   ;;
 esac