/usr/share/doc/HOWTO/ja-html/Bash-Prompt-HOWTO-5.html is in doc-linux-ja-html 2006.05.25-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Bash Prompt HOWTO: ANSI $B%(%9%1!<%W%7!<%1%s%9(B: $B?'$H%+!<%=%kA`:n(B</TITLE>
<LINK HREF="Bash-Prompt-HOWTO-6.html" REL=next>
<LINK HREF="Bash-Prompt-HOWTO-4.html" REL=previous>
<LINK HREF="Bash-Prompt-HOWTO.html#toc5" REL=contents>
</HEAD>
<BODY>
<A HREF="Bash-Prompt-HOWTO-6.html">$B<!$N%Z!<%8(B</A>
<A HREF="Bash-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k!<$N?'$,$b$H$N?'$KLa$i$J$$(B
$B$N$G!"%W%m%s%W%H$N8e$K%?%$%W$7$?J8;z$b%W%m%s%W%H$HF1$8?'$K$J$C$F$7$^$&(B
$B$3$H$G$9!#$^$?!"$3$N%V%k!<$O0E$$$N$G!"(B<B>bold</B> $B%3!<%I$bAH$_9g$o$;$^$9!#(B
<BLOCKQUOTE><CODE>
<PRE>
PS1="\[\033[1;34m\][\$(date +%H%M)][\u@\h:\w]$\[\033[0m\] "
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>$B%W%m%s%W%H$OL@$k$$%V%k!<$KJQ$o$j!":G8e$K?'$r$J$7$K$7$F$$$^$9!#(B($B?'$J$7$O!"(B
$B85$N%U%)%"%0%i%&%s%I%+%i!<$G$9!#(B)
<P>
<P>$B?'$O<!$N$h$&$KDj5A$5$l$F$$$^$9!#(B
<P>
<BLOCKQUOTE><CODE>
<PRE>
Black 0;30 Dark Gray 1;30
Blue 0;34 Light Blue 1;34
Green 0;32 Light Green 1;32
Cyan 0;36 Light Cyan 1;36
Red 0;31 Light Red 1;31
Purple 0;35 Light Purple 1;35
Brown 0;33 Yellow 1;33
Light Gray 0;37 White 1;37
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>$B%P%C%/%0%i%&%s%I%+%i!<$b$3$NJ}K!$G;XDj$9$k$3$H$,$G$-$^$9!#$?$H$($P(B44$B$J$i(B
$B%V%k!<!"(B41$B$J$i@V$H$$$&$U$&$K$J$C$F$$$^$9!#(B
$B%P%C%/%0%i%&%s%I%+%i!<$K$O%\!<%k%I$N$b$N$,$"$j$^$;$s!#(B
$B%V%k!<$NGX7J$K%i%$%H%l%C%I$N%F%-%9%H$rI=<($9$k$J$i!"(B
<B>\[\033[44;1;31m\]</B> $B$N$h$&$KAH$_9g$o$;$F;H$&$3$H$b$G$-$^$,!"(B
<B>\[\033[44m\]\[\033[1;31m\]</B> $B$N$h$&$KJ,$1$F@_Dj$7$?J}$,$$$$$h$&$G$9!#(B
$BB>$N%3!<%I$H$7$F$O!"(B4:$B2<@~!"(B5:$BE@LG!"(B7:$B5UE>!"(B8:$BHsI=<($J$I$,$"$j$^$9!#(B
<P><B>$BCm(B:</B>$BB?$/$N?M(B($B;d$r4^$a(B)$B$O!"E@LGB0@-$K6/$/H?BP$7$^$9!#9,$$$3$l$O(B
$BC<Kv%(%_%e%l!<%?$G$O:nF0$7$^$;$s$,!"%3%s%=!<%k$G$O5!G=$7$^$9!#$^$?!"(B
($B;d$,$=$&$G$"$k$h$&$K(B)$BHsI=<(B0@-$O2?$N$?$a$K$"$k$N$@$m$&$H;W$&$G$7$g$&!#(B
($B%W%m%s%W%H$G$O$J$/(B)$B%7%'%k%9%/%j%W%H$NNc$G!"%Q%9%o!<%I$rF~NO$7$F$b%9%/%j!<%s(B
$B$KI=<($5$l$J$$$h$&$K;H$o$l$F$$$k$N$r8+$?$3$H$,$"$j$^$9!#(B
<P>
<P>Bashprompt $B%Q%C%1!<%8$NCf$N(B elite2 $B$H$$$&%W%m%s%W%H$r(B($B85$N$,(B xterm $B$N%U%)%s%H(B
$B$GMQ$$$k$h$&$K$J$C$F$$$?$N$G!"%3%s%=!<%k$G;H$($k$h$&$K(B)$B=$@5$7$?$b$N$O!"(B
$B;d$N$h$/;H$C$F$$$?$b$N$G$9!#(B
<HR>
<PRE>
function elite
{
local GRAY="\[\033[1;30m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local CYAN="\[\033[0;36m\]"
local LIGHT_CYAN="\[\033[1;36m\]"
case $TERM in
xterm*)
local TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
local TITLEBAR=""
;;
esac
local GRAD1=$(tty|cut -d/ -f3)
PS1="$TITLEBAR\
$GRAY-$CYAN-$LIGHT_CYAN(\
$CYAN\u$GRAY@$CYAN\h\
$LIGHT_CYAN)$CYAN-$LIGHT_CYAN(\
$CYAN\#$GRAY/$CYAN$GRAD1\
$LIGHT_CYAN)$CYAN-$LIGHT_CYAN(\
$CYAN\$(date +%H%M)$GRAY/$CYAN\$(date +%d-%b-%y)\
$LIGHT_CYAN)$CYAN-$GRAY-\
$LIGHT_GRAY\n\
$GRAY-$CYAN-$LIGHT_CYAN(\
$CYAN\$$GRAY:$CYAN\w\
$LIGHT_CYAN)$CYAN-$GRAY-$LIGHT_GRAY "
PS2="$LIGHT_CYAN-$CYAN-$GRAY-$LIGHT_GRAY "
}
</PRE>
<HR>
<P>
<P>$B?'$r0l;~E*%7%'%kJQ?t$H$7$FFI$_0W$$$b$N$KDj5A$7$^$9!#(BGRAD1 $BJQ?t$O(B
$B;H$C$F$$$kC<Kv$r7h$a$k$N$KMQ$$$F$$$^$9!#(BXterm $B>e$+$I$&$+$N%A%'%C%/$H(B
$BF1MM!"$3$l$b0lEY9T$J$($P==J,$G$9!#7k2L$O?'$r=|$1$P$3$N$h$&$K8+$($^$9!#(B
<BLOCKQUOTE><CODE>
<PRE>
--(giles@nikola)-(75/ttyp7)-(1908/12-Oct-98)--
--($:~/tmp)--
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>$B$I$s$J?'$,;H$($k$N$+$r;W$$=P$9$?$a$K!"<!$N%9%/%j%W%H$O$9$Y$F$N?'$r%9%/%j!<%s(B
$B$K%(%3!<$7$^$9!#(B
<P>
<HR>
<PRE>
#!/bin/bash
#
# $B$3$N%U%!%$%k$O!"MM!9$J%+%i!<%3!<%I$rC<Kv$K%(%3!<$7!"$I$s$J?'$,(B
# $B;HMQ2DG=$+$r<($7$^$9!#(B
# $B$=$l$>$l$N9T$G$O!"9u$H%0%l%$$NGX7J$N>e$K0l$D$N?'$r<($7!"%3!<%I$rCf1{$K(B
# $BI=<($7$F$$$^$9!#Gr!"9u!"%0%j!<%s$NGX7J?'$G3NG'$7$F$"$j$^$9!#(B(2 Dec 98)
#
echo " On Light Gray: On Black:"
echo -e "\033[47m\033[1;37m White \033[0m\
1;37m \
\033[40m\033[1;37m White \033[0m"
echo -e "\033[47m\033[37m Light Gray \033[0m\
37m \
\033[40m\033[37m Light Gray \033[0m"
echo -e "\033[47m\033[1;30m Gray \033[0m\
1;30m \
\033[40m\033[1;30m Gray \033[0m"
echo -e "\033[47m\033[30m Black \033[0m\
30m \
\033[40m\033[30m Black \033[0m"
echo -e "\033[47m\033[31m Red \033[0m\
31m \
\033[40m\033[31m Red \033[0m"
echo -e "\033[47m\033[1;31m Light Red \033[0m\
1;31m \
\033[40m\033[1;31m Light Red \033[0m"
echo -e "\033[47m\033[32m Green \033[0m\
32m \
\033[40m\033[32m Green \033[0m"
echo -e "\033[47m\033[1;32m Light Green \033[0m\
1;32m \
\033[40m\033[1;32m Light Green \033[0m"
echo -e "\033[47m\033[33m Brown \033[0m\
33m \
\033[40m\033[33m Brown \033[0m"
echo -e "\033[47m\033[1;33m Yellow \033[0m\
1;33m \
\033[40m\033[1;33m Yellow \033[0m"
echo -e "\033[47m\033[34m Blue \033[0m\
34m \
\033[40m\033[34m Blue \033[0m"
echo -e "\033[47m\033[1;34m Light Blue \033[0m\
1;34m \
\033[40m\033[1;34m Light Blue \033[0m"
echo -e "\033[47m\033[35m Purple \033[0m\
35m \
\033[40m\033[35m Purple \033[0m"
echo -e "\033[47m\033[1;35m Pink \033[0m\
1;35m \
\033[40m\033[1;35m Pink \033[0m"
echo -e "\033[47m\033[36m Cyan \033[0m\
36m \
\033[40m\033[36m Cyan \033[0m"
echo -e "\033[47m\033[1;36m Light Cyan \033[0m\
1;36m \
\033[40m\033[1;36m Light Cyan \033[0m"
</PRE>
<HR>
<P>
<H2><A NAME="ss5.2">5.2 $B%+!<%=%kA`:n(B</A>
</H2>
<P>ANSI$B%(%9%1!<%W%7!<%1%s%9$G%+!<%=%k$r%9%/%j!<%s>e$G<+M3$KF0$+$;$^$9!#(B
$B$3$l$O%7%'%k%9%/%j%W%H$G%U%k%9%/%j!<%s$N%f!<%6!<%$%s%?!<%U%'!<%9$r(B
$B:n$k;~$KLr$KN)$A$^$9$,!"%W%m%s%W%H$G$b;H$($^$9!#%+!<%=%kA`:n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%H$N$H$3$m$K(B
$B%+!<%=%k$rLa$7$^$9!#$3$l$O%W%m%s%W%H$G$O$"$j$^$;$s!#2?$,5/$3$C$F$$$k$+$r(B
$B$O$C$-$j$5$;$k$?$a$K?'$rJQ$($F!"%+!<%=%k$r%9%/%j!<%s>e$GF0$+$7$F$_$;$F$$$k(B
$B$@$1$G$9!#(B
<P>
<P>$B<!$r(B"clock"$B$H$$$&L>A0$N%U%!%$%k$KF~$l$F2<$5$$!#(B
<P>
<HR>
<PRE>
#!/bin/bash
function prompt_command {
let prompt_x=$COLUMNS-5
}
PROMPT_COMMAND=prompt_command
function clock {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local WHITE="\[\033[1;37m\]"
local NO_COLOUR="\[\033[0m\]"
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}\
\[\033[s\033[1;\$(echo -n \${prompt_x})H\]\
$BLUE[$LIGHT_RED\$(date +%H%M)$BLUE]\[\033[u\033[1A\]
$BLUE[$LIGHT_RED\u@\h:\w$BLUE]\
$WHITE\$$NO_COLOUR "
PS2='> '
PS4='+ '
}
</PRE>
<HR>
<P>
<P>$B$3$N%W%m%s%W%H$G9T$J$o$l$F$$$k$3$H$OHf3SE*C1=c$G!"C<Kv$N1&>e$K(B24$B;~4V@)$N(B
$B;~9o$,I=<($5$l$^$9!#(B($BC<Kv$N%5%$%:$rJQ$($F$bBg>fIW$G$9!#(B)$B$3$l$O!"%+!<%=%k$N(B
$B0LCV$N5-21$H2sI|$r%5%]!<%H$7$F$$$J$$C<Kv%(%_%e%l!<%?$G$O$&$^$/$$$-$^$;$s!#(B
$B$=$N$h$&$JC<Kv%(%_%e%l!<%?$G$3$l$r<B9T$9$k$H!";~9o$O@53N$KI=<($5$l$^$9$,!"(B
$B%W%m%s%W%H$OC<Kv$N(B2$B9TL\$+$iF0$-$^$;$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