comparison rc/bash @ 254:dde04581a2bf

Combined PS1 and PROMPT_COMMAND conditional.
author Edho Arief <edho@myconan.net>
date Mon, 14 Nov 2011 11:08:45 +0300
parents e6de49d70fe7
children 4a0f963a3ff1
comparison
equal deleted inserted replaced
253:e6de49d70fe7 254:dde04581a2bf
18 18
19 # Custom application I usually install and safe to prioritize 19 # Custom application I usually install and safe to prioritize
20 for i in {"${HOME}/app","/opt"}/{tmux,ruby19,node,tarsnap,symon,nginx}/{bin,sbin}; do 20 for i in {"${HOME}/app","/opt"}/{tmux,ruby19,node,tarsnap,symon,nginx}/{bin,sbin}; do
21 [ -d "${i}" ] && PATH="${i}:${PATH}" 21 [ -d "${i}" ] && PATH="${i}:${PATH}"
22 done 22 done
23
24 case "${TERM}" in
25 xterm*|dtterm*|screen*)
26 PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ '
27 ;;
28 *)
29 PS1='[\u@\h \W]\$ '
30 ;;
31 esac
32 23
33 shopt -s histappend 24 shopt -s histappend
34 PROMPT_COMMAND='history -a' 25 PROMPT_COMMAND='history -a'
35 export HISTFILESIZE=10000 26 export HISTFILESIZE=10000
36 export HISTCONTROL=ignoredups 27 export HISTCONTROL=ignoredups
112 unset _has_gnu_grep 103 unset _has_gnu_grep
113 unset _ls 104 unset _ls
114 105
115 106
116 case "${TERM}" in 107 case "${TERM}" in
117 xterm*|screen*|dtterm) 108 xterm*|screen*|dtterm*)
118 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007";'"${PROMPT_COMMAND}" 109 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007";'"${PROMPT_COMMAND}"
110 PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ '
111 ;;
112 *)
113 PS1='[\u@\h \W]\$ '
119 ;; 114 ;;
120 esac 115 esac
121 116
122 if command -v vim > /dev/null 2>&1; then 117 if command -v vim > /dev/null 2>&1; then
123 alias vi=vim 118 alias vi=vim