This file is indexed.

/usr/share/doc/HOWTO/ja-html/Bash-Prompt-HOWTO-10.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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
<!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: $B%W%m%s%W%H$NNc(B</TITLE>
 <LINK HREF="Bash-Prompt-HOWTO-9.html" REL=previous>
 <LINK HREF="Bash-Prompt-HOWTO.html#toc10" REL=contents>
</HEAD>
<BODY>
$B<!$N%Z!<%8(B
<A HREF="Bash-Prompt-HOWTO-9.html">$BA0$N%Z!<%8(B</A>
<A HREF="Bash-Prompt-HOWTO.html#toc10">$BL\<!$X(B</A>
<HR>
<H2><A NAME="s10">10. $B%W%m%s%W%H$NNc(B</A></H2>

<H2><A NAME="ss10.1">10.1 $B!V7ZNL!W%W%m%s%W%H(B</A>
</H2>

<P>
<HR>
<PRE>

function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
case $TERM in
    xterm*)
        TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        ;;
    *)
        TITLEBAR=""
        ;;
esac

PS1="${TITLEBAR}\
$BLUE[$RED\$(date +%H%M)$BLUE]\
$BLUE[$LIGHT_RED\u@\h:\w$BLUE]\
$WHITE\$$LIGHT_GRAY "
PS2='> '
PS4='+ '
}
</PRE>
<HR>
<P>
<H2><A NAME="ss10.2">10.2 Bashprompt$B$+$i(Belite</A>
</H2>

<P>VGA $B%U%)%s%H$,I,MW$G$9!#(B
<P>
<HR>
<PRE>

# Created by KrON from windowmaker on IRC
# Changed by Spidey 08/06
function elite {
PS1="\[\033[31m\]\332\304\[\033[34m\](\[\033[31m\]\u\[\033[34m\]@\[\033[31m\]\h\
\[\033[34m\])\[\033[31m\]-\[\033[34m\](\[\033[31m\]\$(date +%I:%M%P)\
\[\033[34m\]-:-\[\033[31m\]\$(date +%m)\[\033[34m\033[31m\]/\$(date +%d)\
\[\033[34m\])\[\033[31m\]\304-\[\033[34m]\\371\[\033[31m\]-\371\371\
\[\033[34m\]\372\n\[\033[31m\]\300\304\[\033[34m\](\[\033[31m\]\W\[\033[34m\])\
\[\033[31m\]\304\371\[\033[34m\]\372\[\033[00m\]"
PS2="> "
}
</PRE>
<HR>
<P>
<H2><A NAME="ss10.3">10.3 $B!V%Q%o!<%f!<%6!<!W%W%m%s%W%H(B</A>
</H2>

<P>$B;d$,<B:]$K;H$C$F$$$k%W%m%s%W%H$G$9!#%7%s%0%k%f!<%6!<$N(B PentiumII-400MHz 
$B$G$b%W%m%s%W%HI=<($NCY$l$,=P$^$9$N$G!"%^%k%A%f!<%6!<$N(B Pentium-100MHz $B$G(B
$B;H$&$N$O$d$a$F$*$$$?J}$,(B...$B!#<B:]$K;H$&$H$$$&$h$j$O!"9M$(J}$NNc$H$7$F(B
$B8+$F$/$@$5$$!#(B
<P>
<HR>
<PRE>
#!/bin/bash
#----------------------------------------------------------------------
#       POWER USER PROMPT "pprom2"
#----------------------------------------------------------------------
#
#   Created August 98, Last Modified 9 November 98 by Giles
#
#   $BLdBj(B:$BIi2Y$,2<$,$C$?;~(B "1.35down-.08" $B$H$J$k$N$G!"(B- $B$r$H$kI,MW$,$"$k!#(B
#   - $PWD $B$ND9$5$r(B30$BJ8;z$^$G$H$7!"D6$($?ItJ,$O1&$r@Z$j<N$F$F$$$k!#(B

function prompt_command
{
#   $BJQ?t(B TotalMeg $B$O8=%G%#%l%/%H%j$N2D;k%U%!%$%k$N%5%$%:$N9g7W(B
local TotalBytes=0
for Bytes in $(ls -l | grep "^-" | cut -c30-41)
do
    let TotalBytes=$TotalBytes+$Bytes
done
TotalMeg=$(echo -e "scale=3 \nx=$TotalBytes/1048576\n if (x&lt;1) {print \"0\"} \n print x \nquit" | bc)

#      uptime $B%3%^%s%I$K$h$j!"Ii2Y$N:9J,$r7W;;!#(B
#      uptime $B$O!"(B1$BJ,!"(B5$BJ,!"(B15$BJ,$NJ?6QIi2Y$r<($9!#(B
#
local one=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\1/" -e "s/ //g")
local five=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\).*/\2/" -e "s/ //g")
local diff1_5=$(echo -e "scale = scale ($one) \nx=$one - $five\n if (x>0) {print \"up\"} else {print \"down\"}\n print x \nquit \n" | bc)
loaddiff="$(echo -n "${one}${diff1_5}")"

#   $B2D;k%U%!%$%k$N?t$r?t$($k(B
let files=$(ls -l | grep "^-" | wc -l | tr -d " ")
let hiddenfiles=$(ls -l -d .* | grep "^-" | wc -l | tr -d " ")
let executables=$(ls -l | grep ^-..x | wc -l | tr -d " ")
let directories=$(ls -l | grep "^d" | wc -l | tr -d " ")
let hiddendirectories=$(ls -l -d .* | grep "^d" | wc -l | tr -d " ")-2
let linktemp=$(ls -l | grep "^l" | wc -l | tr -d " ")
if [ "$linktemp" -eq "0" ]
then
    links=""
else
    links=" ${linktemp}l"
fi
unset linktemp
let devicetemp=$(ls -l | grep "^[bc]" | wc -l | tr -d " ")
if [ "$devicetemp" -eq "0" ]
then
    devices=""
else
    devices=" ${devicetemp}bc"
fi
unset devicetemp

}

PROMPT_COMMAND=prompt_command

function pprom2 {

local        BLUE="\[\033[0;34m\]"
local  LIGHT_GRAY="\[\033[0;37m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
local  LIGHT_BLUE="\[\033[1;34m\]"
local  LIGHT_CYAN="\[\033[1;36m\]"
local      YELLOW="\[\033[1;33m\]"
local       WHITE="\[\033[1;37m\]"
local         RED="\[\033[0;31m\]"

case $TERM in
    xterm*)
        TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        ;;
    *)
        TITLEBAR=""
        ;;
esac

PS1="$TITLEBAR\
$BLUE[$RED\$(date +%H%M)$BLUE]\
$BLUE[$RED\u@\h$BLUE]\
$BLUE[\
$LIGHT_GRAY\${files}.\${hiddenfiles}-\
$LIGHT_GREEN\${executables}x \
$LIGHT_GRAY(\${TotalMeg}Mb) \
$LIGHT_BLUE\${directories}.\
\${hiddendirectories}d\
$LIGHT_CYAN\${links}\
$YELLOW\${devices}\
$BLUE]\
$BLUE[${WHITE}\${loaddiff}$BLUE]\
$BLUE[\
$WHITE\$(ps ax | wc -l | sed -e \"s: ::g\")proc\
$BLUE]\
\n\
$BLUE[$RED\$PWD$BLUE]\
$WHITE\$\
\
$LIGHT_GRAY "
PS2='> '
PS4='+ '
}
</PRE>
<HR>
<P>
<H2><A NAME="ss10.4">10.4 $BC<KvI}$N%W%m%s%W%H(B</A>
</H2>

<P>$B%W%m%s%W%H$K(B $PWD $B$,4^$^$l$k$H!"%W%m%s%W%H$ND9$5$,JQ$o$k$H$J$2$/M'?M$,$$$?(B
$B$N$G!"%W%m%s%W%H$ND9$5$,$A$g$&$IC<Kv$NI}$K$J$k%W%m%s%W%H$r=q$$$F$_$^$7$?!#(B
<P>
<HR>
<PRE>
#!/bin/bash

#   $BC<KvI}$N%W%m%s%W%H(B
#      by Giles - created 2 November 98
#                 last modified 9 November 98
#
#   $B$3$3$G9M$($?$N$O!"(B2$B9T$+$i$J$k%W%m%s%W%H$N(B1$B9TL\$,C<Kv$NI}$K$J$k$h$&$K(B
#   $B$9$k$3$H$G$9!#$=$&$9$k$?$a$K!"%F%-%9%H$NJ8;z?t$r?t$(!"I}$K9g$&$h$&$K(B
#   $PWD $B$rJd$C$?$j!"1&$r@Z$j5M$a$?$j$7$^$9!#(B
#
#   - $B$b$C$H@vN}$5$;$kI,MW$,$"$j$^$9$,!"$H$j$"$($:F0$-$^$9!#(B
#   - $B%[%9%HL>$OKh2s$5$,$9I,MW$,$"$j$^$;$s!#JQ2=$7$^$;$s$+$i!#(B
#   - $B%f!<%6!<L>$O$I$&$@$m$&(B? $BJQ$o$k$+$J$"(B?
#   - prompt_command $B$G:n$i$l$k%F%-%9%HJQ?t$O6I=jJQ?t$G$O$$$1$J$$!#(B
#     PS1 $B$KJ]B8$5$l$kI,MW$,$"$k$+$i!#(B

function prompt_command {

TERMWIDTH=${COLUMNS}

#   $B%W%m%s%W%HI}$r7W;;(B

hostnam=$(echo -n $HOSTNAME | sed -e "s/[\.].*//")
let hostsize=$(echo -n $hostnam | wc -c | tr -d " ")
#   "whoami" $B$H(B "pwd" $B$N:G8e$O2~9T$K$J$C$F$$$k!#(B
usernam=$(whoami)
let usersize=$(echo -n $usernam | wc -c | tr -d " ")
newPWD="${PWD}"
let pwdsize=$(echo -n ${newPWD} | wc -c | tr -d " ")
#   $B%"%/%;%5%j$r$D$1$F$$$/(B
let promptsize=$(echo -n "--(${usernam}@${hostnam})---(${PWD})--" \
                 | wc -c | tr -d " ")
let fillsize=${TERMWIDTH}-${promptsize}
fill=""
while [ "$fillsize" -gt "0" ] 
do 
    fill="${fill}-"
        let fillsize=${fillsize}-1
done

if [ "$fillsize" -lt "0" ]
then
    let cut=((${fillsize})*(-1))+3
    sedvar=""
    while [ "$cut" -gt "0" ]
    do
        sedvar="${sedvar}."
    let cut=${cut}-1
    done
    newPWD="...$(echo -n $PWD | sed -e "s/\(^${sedvar}\)\(.*\)/\2/")"
fi
}

PROMPT_COMMAND=prompt_command

function termwide {

local GRAY="\[\033[1;30m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local WHITE="\[\033[1;37m\]"

local LIGHT_BLUE="\[\033[1;34m\]"
local YELLOW="\[\033[1;33m\]"

case $TERM in
    xterm*)
        TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        ;;
    *)
        TITLEBAR=""
        ;;
esac

PS1="$TITLEBAR\
$YELLOW-$LIGHT_BLUE-(\
$YELLOW\${usernam}$LIGHT_BLUE@$YELLOW\${hostnam}\
${LIGHT_BLUE})-${YELLOW}-\${fill}${LIGHT_BLUE}-(\
$YELLOW\${newPWD}\
$LIGHT_BLUE)-$YELLOW-\
\n\
$YELLOW-$LIGHT_BLUE-(\
$YELLOW\$(date +%H%M)$LIGHT_BLUE:$YELLOW\$(date \"+%a,%d %b %y\")\
$LIGHT_BLU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~$rI=<($7!"1&>e$N;~9oI=<($K$D$J$,$C(B
#   $B$F$$$k!#(B

function prompt_command {
#   Calculate the width of the prompt:
hostnam=$(echo -n $HOSTNAME | sed -e "s/[\.].*//")
#   "whoami"$B$H(B"pwd"$B$O:G8e$K2~9T$r4^$s$G$$$k!#(B
usernam=$(whoami)
newPWD="${PWD}"
#   $B$9$Y$F$N%"%/%;%5%j$r0J2<$K2C$($k!#(B
let promptsize=$(echo -n "--(${usernam}@${hostnam})---(${PWD})-----" \
                 | wc -c | tr -d " ")
#   user@host $B$H(B PWD $B$N4V$K$I$l$@$12C$($l$P$$$$$+(B(PWD $B$+$i@Z$j<h$l$P$h$$$+(B)$B$r(B
#   $B7W;;$9$k!#(B
let fillsize=${COLUMNS}-${promptsize}
fill=""
#   $B%W%m%s%W%H$,C<KvI}$h$jC;$$>l9g$K$O!"Kd$aAp$r:n$k!#(B
while [ "$fillsize" -gt "0" ] 
do 
   fill="${fill}"
   # A $B%&%`%i%&%H(B(VGA $B%U%)%s%H$G$OD9$$2#@~(B)$B$O(B\304$B$G$9$,!"(BBash $B$G$OCV49$O(B
   # $B0l<oN`$7$+9T$J$o$l$:!"$3$3$G$O(B $fill $B$r%W%m%s%W%H$KKd$a9~$`$3$H$J(B
   # $B$N$G!"$3$N$h$&$KJQ$($^$7$?!#(B
   let fillsize=${fillsize}-1
done
#   $B%W%m%s%W%H$,C<KvI}$h$jD92a$.$k$h$&$J$i!"(BPWD $B$N1&$r@Z$j<N$F$^$9!#(B
if [ "$fillsize" -lt "0" ]
then
   let cutt=3-${fillsize}
   sedvar=""
   while [ "$cutt" -gt "0" ]
   do
      sedvar="${sedvar}."
      let cutt=${cutt}-1
   done
   newPWD="...$(echo -n $PWD | sed -e "s/\(^${sedvar}\)\(.*\)/\2/")"
fi
#
#   $B;~9o$HC<Kv$N1&C<$KI=<($9$k%P!<$r:n$j$^$9!#(B
#
local LIGHT_BLUE="\033[1;34m"
local     YELLOW="\033[1;33m"
#   $B;~9o$rI=<($9$k%+!<%=%k$N0LCV$r7h$a$^$9!#(B
echo -en "\033[2;$((${COLUMNS}-9))H"
echo -en "$LIGHT_BLUE($YELLOW$(date +%H%M)$LIGHT_BLUE)\304$YELLOW\304\304\277"
local i=${LINES}
echo -en "\033[2;${COLUMNS}H"
#   $B=D@~$rC<Kv$NOF$KI=<($7$^$9!#(B
while [ $i -ge 4 ]
do
   echo -en "\033[$(($i-1));${COLUMNS}H\263"
   let i=$i-1
done

let prompt_line=${LINES}-1
#   Bash$B$N?t<0I=8=(B($(()))$B$NCf$G$O!"(B\${LINES}$B$,$&$^$/5!G=$7$J$$$h$&$J$N$G(B
}

PROMPT_COMMAND=prompt_command

function clock3 {
local LIGHT_BLUE="\[\033[1;34m\]"
local     YELLOW="\[\033[1;33m\]"
local      WHITE="\[\033[1;37m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local  NO_COLOUR="\[\033[0m\]"

case $TERM in
    xterm*)
        TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        ;;
    *)
        TITLEBAR=""
        ;;
esac

PS1="$TITLEBAR\
\[\033[\${prompt_line};0H\]
$YELLOW\332$LIGHT_BLUE\304(\
$YELLOW\${usernam}$LIGHT_BLUE@$YELLOW\${hostnam}\
${LIGHT_BLUE})\304${YELLOW}\304\${fill}${LIGHT_BLUE}\304(\
$YELLOW\${newPWD}\
$LIGHT_BLUE)\304$YELLOW\304\304\304\331\
\n\
$YELLOW\300$LIGHT_BLUE\304(\
$YELLOW\$(date \"+%a,%d %b %y\")\
$LIGHT_BLUE:$WHITE\$$LIGHT_BLUE)\304\
$YELLOW\304\
$LIGHT_GRAY " 

PS2="$LIGHT_BLUE\304$YELLOW\304$YELLOW\304$NO_COLOUR "

}
</PRE>
<HR>
<P>
<P>$BK]Lu(B     $B1sF#(B $BL@(B akendo@t3.rim.or.jp
<P>$B9;@56(NO(B yuri aisaka &lt;ayqw@mail2.alpha-net.or.jp&gt;
HASEGAWA Yasushi &lt;yaz-hase@qb3.so-net.ne.jp&gt;
<HR>
$B<!$N%Z!<%8(B
<A HREF="Bash-Prompt-HOWTO-9.html">$BA0$N%Z!<%8(B</A>
<A HREF="Bash-Prompt-HOWTO.html#toc10">$BL\<!$X(B</A>
</BODY>
</HTML>