changeset 258:0cd601956a9a

Merge.
author Edho Arief <edho@myconan.net>
date Sun, 20 Nov 2011 23:21:45 +0700
parents d7e5a2e70cf3 (current diff) adcea08f6807 (diff)
children 1e214a53237d
files
diffstat 2 files changed, 45 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/colors	Sun Nov 20 23:21:45 2011 +0700
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+#
+#   This file echoes a bunch of color codes to the 
+#   terminal to demonstrate what's available.  Each 
+#   line is the color code of one forground color,
+#   out of 17 (default + 16 escapes), followed by a 
+#   test use of that color on all nine background 
+#   colors (default + 8 escapes).
+#
+
+T='gYw'   # The test text
+
+echo -e "\n                 40m     41m     42m     43m\
+     44m     45m     46m     47m";
+
+for FGs in '    m' '   1m' '  30m' '1;30m' '  31m' '1;31m' '  32m' \
+           '1;32m' '  33m' '1;33m' '  34m' '1;34m' '  35m' '1;35m' \
+           '  36m' '1;36m' '  37m' '1;37m';
+  do FG=${FGs// /}
+  echo -en " $FGs \033[$FG  $T  "
+  for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
+    do echo -en "$EINS \033[$FG\033[$BG  $T  \033[0m";
+  done
+  echo;
+done
+echo
--- 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