|
@@ -1127,51 +1127,56 @@ __my_alert_fail(){ |
|
|
# http://archive.linux.or.jp/JF/JFdocs/Bash-Prompt-HOWTO-5.html |
|
|
# http://archive.linux.or.jp/JF/JFdocs/Bash-Prompt-HOWTO-5.html |
|
|
# http://www.grapecity.com/japan/powernews/column/clang/047/page02.htm |
|
|
# http://www.grapecity.com/japan/powernews/column/clang/047/page02.htm |
|
|
|
|
|
|
|
|
if $inzsh |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if $inbash || $inzsh |
|
|
then |
|
|
then |
|
|
__attr_beg=$'%{\033[' |
|
|
|
|
|
__attr_end='m%}' |
|
|
|
|
|
else |
|
|
|
|
|
__attr_beg='\[\033[' |
|
|
|
|
|
__attr_end='m\]' |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
if $inzsh |
|
|
|
|
|
then |
|
|
|
|
|
__attr_beg=$'%{\033[' |
|
|
|
|
|
__attr_end='m%}' |
|
|
|
|
|
else |
|
|
|
|
|
__attr_beg='\[\033[' |
|
|
|
|
|
__attr_end='m\]' |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
__color_default="${__attr_beg}0${__attr_end}" |
|
|
|
|
|
|
|
|
|
|
|
__color_black="${__attr_beg}0;30${__attr_end}" |
|
|
|
|
|
__color_red="${__attr_beg}0;31${__attr_end}" |
|
|
|
|
|
__color_green="${__attr_beg}0;32${__attr_end}" |
|
|
|
|
|
__color_brown="${__attr_beg}0;33${__attr_end}" |
|
|
|
|
|
__color_blue="${__attr_beg}0;34${__attr_end}" |
|
|
|
|
|
__color_purple="${__attr_beg}0;35${__attr_end}" |
|
|
|
|
|
__color_cyan="${__attr_beg}0;36${__attr_end}" |
|
|
|
|
|
__color_light_gray="${__attr_beg}0;37${__attr_end}" |
|
|
|
|
|
|
|
|
|
|
|
__color_dark_gray="${__attr_beg}1;30${__attr_end}" |
|
|
|
|
|
__color_light_red="${__attr_beg}1;31${__attr_end}" |
|
|
|
|
|
__color_light_green="${__attr_beg}1;32${__attr_end}" |
|
|
|
|
|
__color_yellow="${__attr_beg}1;33${__attr_end}" |
|
|
|
|
|
__color_light_blue="${__attr_beg}1;34${__attr_end}" |
|
|
|
|
|
__color_light_purple="${__attr_beg}1;35${__attr_end}" |
|
|
|
|
|
__color_light_cyan="${__attr_beg}1;36${__attr_end}" |
|
|
|
|
|
__color_white="${__attr_beg}1;37${__attr_end}" |
|
|
|
|
|
|
|
|
|
|
|
__color_bg_black="${__attr_beg}40${__attr_end}" |
|
|
|
|
|
__color_bg_red="${__attr_beg}41${__attr_end}" |
|
|
|
|
|
__color_bg_green="${__attr_beg}42${__attr_end}" |
|
|
|
|
|
__color_bg_brown="${__attr_beg}43${__attr_end}" |
|
|
|
|
|
__color_bg_blue="${__attr_beg}44${__attr_end}" |
|
|
|
|
|
__color_bg_purple="${__attr_beg}45${__attr_end}" |
|
|
|
|
|
__color_bg_cyan="${__attr_beg}46${__attr_end}" |
|
|
|
|
|
__color_bg_light_gray="${__attr_beg}47${__attr_end}" |
|
|
|
|
|
|
|
|
|
|
|
__attr_underline="${__attr_beg}4${__attr_end}" |
|
|
|
|
|
__attr_reverse="${__attr_beg}7${__attr_end}" |
|
|
|
|
|
__attr_bold="${__attr_beg}1${__attr_end}" |
|
|
|
|
|
|
|
|
__color_default="${__attr_beg}0${__attr_end}" |
|
|
|
|
|
|
|
|
|
|
|
__color_black="${__attr_beg}0;30${__attr_end}" |
|
|
|
|
|
__color_red="${__attr_beg}0;31${__attr_end}" |
|
|
|
|
|
__color_green="${__attr_beg}0;32${__attr_end}" |
|
|
|
|
|
__color_brown="${__attr_beg}0;33${__attr_end}" |
|
|
|
|
|
__color_blue="${__attr_beg}0;34${__attr_end}" |
|
|
|
|
|
__color_purple="${__attr_beg}0;35${__attr_end}" |
|
|
|
|
|
__color_cyan="${__attr_beg}0;36${__attr_end}" |
|
|
|
|
|
__color_light_gray="${__attr_beg}0;37${__attr_end}" |
|
|
|
|
|
|
|
|
|
|
|
__color_dark_gray="${__attr_beg}1;30${__attr_end}" |
|
|
|
|
|
__color_light_red="${__attr_beg}1;31${__attr_end}" |
|
|
|
|
|
__color_light_green="${__attr_beg}1;32${__attr_end}" |
|
|
|
|
|
__color_yellow="${__attr_beg}1;33${__attr_end}" |
|
|
|
|
|
__color_light_blue="${__attr_beg}1;34${__attr_end}" |
|
|
|
|
|
__color_light_purple="${__attr_beg}1;35${__attr_end}" |
|
|
|
|
|
__color_light_cyan="${__attr_beg}1;36${__attr_end}" |
|
|
|
|
|
__color_white="${__attr_beg}1;37${__attr_end}" |
|
|
|
|
|
|
|
|
|
|
|
__color_bg_black="${__attr_beg}40${__attr_end}" |
|
|
|
|
|
__color_bg_red="${__attr_beg}41${__attr_end}" |
|
|
|
|
|
__color_bg_green="${__attr_beg}42${__attr_end}" |
|
|
|
|
|
__color_bg_brown="${__attr_beg}43${__attr_end}" |
|
|
|
|
|
__color_bg_blue="${__attr_beg}44${__attr_end}" |
|
|
|
|
|
__color_bg_purple="${__attr_beg}45${__attr_end}" |
|
|
|
|
|
__color_bg_cyan="${__attr_beg}46${__attr_end}" |
|
|
|
|
|
__color_bg_light_gray="${__attr_beg}47${__attr_end}" |
|
|
|
|
|
|
|
|
|
|
|
__attr_underline="${__attr_beg}4${__attr_end}" |
|
|
|
|
|
__attr_reverse="${__attr_beg}7${__attr_end}" |
|
|
|
|
|
__attr_bold="${__attr_beg}1${__attr_end}" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
# NOTE: tput is another easy way to set colors and background |
|
|
# NOTE: tput is another easy way to set colors and background |
|
|
# For example, "$(tput setab 4)text$(tput sgr0)" print text with background |
|
|
# For example, "$(tput setab 4)text$(tput sgr0)" print text with background |
|
|
# color blue. |
|
|
# color blue. |
|
|
|
|
|
# http://www.ibm.com/developerworks/jp/linux/aix/library/au-learningtput/index.html |
|
|
|
|
|
|
|
|
if test "$TERM" != dumb |
|
|
if test "$TERM" != dumb |
|
|
then |
|
|
then |
|
@@ -1216,16 +1221,19 @@ __my_ps1_move_15left="\[\033[15D\]" |
|
|
# __my_ps1_right="${__my_ps1_save_pos}${__my_ps1_move_rightmost}" |
|
|
# __my_ps1_right="${__my_ps1_save_pos}${__my_ps1_move_rightmost}" |
|
|
# ${__my_ps1_move_15left}\D{%Y/%m/%d %H:%M}${__my_ps1_restore_pos} |
|
|
# ${__my_ps1_move_15left}\D{%Y/%m/%d %H:%M}${__my_ps1_restore_pos} |
|
|
|
|
|
|
|
|
$inbash && PS1="\ |
|
|
|
|
|
${__my_c4}:: ${__my_cdef}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}]\$(__my_ps1_info)\n\ |
|
|
|
|
|
${__my_c4}:: ${__my_cdef}\D{%Y/%m/%d %H:%M} \$(__my_ps1_jobs \j)${__my_ps1_str}\$(__my_alert_fail)${__my_ps1_right}\$ " |
|
|
|
|
|
|
|
|
|
|
|
if $inzsh |
|
|
if $inzsh |
|
|
then |
|
|
then |
|
|
PROMPT="\ |
|
|
PROMPT="\ |
|
|
${__my_c4}:: ${__my_cdef}[${__my_c2}%n@%M${__my_cdef}:${__my_c1}%~/${__my_cdef}]\$(__my_ps1_info) |
|
|
${__my_c4}:: ${__my_cdef}[${__my_c2}%n@%M${__my_cdef}:${__my_c1}%~/${__my_cdef}]\$(__my_ps1_info) |
|
|
${__my_c4}:: ${__my_cdef}\$(__my_ps1_jobs)${__my_ps1_str}\$(__my_alert_fail)%# " |
|
|
${__my_c4}:: ${__my_cdef}\$(__my_ps1_jobs)${__my_ps1_str}\$(__my_alert_fail)%# " |
|
|
RPROMPT="%D{%Y/%m/%d %H:%M}" |
|
|
RPROMPT="%D{%Y/%m/%d %H:%M}" |
|
|
|
|
|
elif $inbash |
|
|
|
|
|
then |
|
|
|
|
|
PS1="\ |
|
|
|
|
|
${__my_c4}:: ${__my_cdef}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}]\$(__my_ps1_info)\n\ |
|
|
|
|
|
${__my_c4}:: ${__my_cdef}\D{%Y/%m/%d %H:%M} \$(__my_ps1_jobs \j)${__my_ps1_str}\$(__my_alert_fail)${__my_ps1_right}\$ " |
|
|
|
|
|
else |
|
|
|
|
|
PS1="$(printf $(whoami)@$(hostname)\n$ )" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
__my_set_header_line(){ |
|
|
__my_set_header_line(){ |
|
|