「Bash カラープロンプト」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(Kusakata がページ「Color Bash Prompt (日本語)」を「Bash カラープロンプト」に移動しました)
(同期)
 
(同じ利用者による、間の3版が非表示)
1行目: 1行目:
  +
#redirect[[Bash/プロンプトのカスタマイズ]]
[[Category:Eye candy (日本語)]]
 
[[Category:Command shells (日本語)]]
 
[[de:Bash-Prompt anpassen]]
 
[[es:Color Bash Prompt]]
 
[[en:Color Bash Prompt]]
 
[[it:Color Bash Prompt]]
 
[[ru:Color Bash Prompt]]
 
[[zh-CN:Color Bash Prompt]]
 
{{Related articles start (日本語)}}
 
{{Related2|Bash (日本語)|Bash}}
 
{{Related2|Environment variables|環境変数}}
 
{{Related articles end}}
 
[[Bash (日本語)|Bash]] プロンプト (PS1) の可能性は幅広く、カスタマイズすることでコマンドラインでの生産性を向上させることができます。情報を追加したりカラー化することで傑出したプロンプトになります。
 
 
このガイドでは''通常ユーザーの個人用プロンプトをカスタマイズ''する方法を紹介します。
 
 
== 変更の適用 ==
 
 
([http://mywiki.wooledge.org/SubShell subshell] がない) {{ic|.bashrc}} に加えた変更は次を実行することで適用されます:
 
$ source ~/.bashrc
 
 
== 基本のプロンプト ==
 
 
以下の設定は root のプロンプトと root 以外のユーザーを見分けるのに役に立ちます。
 
 
=== 通常ユーザー ===
 
 
''通常ユーザー''の緑のプロンプト:
 
 
<div style="font-family: monospace; white-space: pre; padding: 1em; border: 3px solid #bcd; background-color: black; color: #aaa;"><span style="color: #0f0">[chiri@zetsubou ~]$</span> <span style="text-decoration: blink;">_</span></div>
 
{{hc|~/.bashrc|
 
<nowiki>#PS1='[\u@\h \W]\$ ' # Default
 
PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '</nowiki>}}
 
 
=== Root ===
 
 
''root'' の赤のプロンプト ({{ic|/etc/skel/}} からコピーしてない場合は、コピーしてください):
 
 
<div style="font-family: monospace; white-space: pre; padding: 1em; border: 3px solid #bcd; background-color: black; color: #aaa;"><span style="color: #f00">[root@zetsubou ~]#</span> <span style="text-decoration: blink;">_</span></div>
 
{{hc|/root/.bashrc|
 
<nowiki>#PS1='[\u@\h \W]\$ ' # Default
 
PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '</nowiki>}}
 
 
== ちょっとだけオシャレなプロンプト ==
 
 
=== 通常ユーザー ===
 
 
''通常ユーザー''の緑/青のプロンプト:
 
 
<div style="font-family: monospace; white-space: pre; padding: 1em; border: 3px solid #bcd; background-color: black; color: #aaa;"><span style="color: #0a0">chiri</span> <span style="color: #00f">~/docs</span> <span style="color: #0f0">$</span> echo "sample output text"<br />sample output text<br /><span style="color: #0a0">chiri</span> <span style="color: #00f">~/docs</span> <span style="color: #0f0">$</span> <span style="text-decoration: blink;">_</span></div>
 
{{bc|<nowiki>PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]'</nowiki>}}
 
 
とても見やすい、明るい白のテキストのコンソールで、カラフルなプロンプトとテーマになります。
 
 
上の文字列にはカラーセットのエスケープシーケンス ({{ic|\[\e[''color''\]}} で始まり {{ic|\[\e[m\]}} で終わる) と情報のプレースホルダが含まれています:
 
 
* '''\u''' - ユーザー名。元のプロンプトにある '''\h''' はホスト名を表示します。
 
* '''\w''' - カレントディレクトリの絶対パス。相対パスを表示するには '''\W''' を使います。
 
* '''\$''' - プロンプト記号 (例: root の場合 {{ic|#}}、通常ユーザーの場合 {{ic|$}})。
 
* '''\[''' と '''\]''' - bash にカーソルを正しく配置する方法を知らせるために、このタグはカラーコードの前後に置きます。
 
 
その他の特殊文字については、gnu.org の [http://www.gnu.org/software/bash/manual/html_node/Printing-a-Prompt.html bash プロンプトのコントロール] のウェブページを見て下さい。
 
 
最後のカラーセットのシーケンス {{ic|\[\e[1;37m\]}} は閉じられていませんが、これは残りのテキスト (ターミナルに入力されたテキストやプログラムの出力など) が明るい白になるようにするためです。出力を元の色で表示するために、この色を変更したり、最後のエスケープシーケンスを削除することが望ましいでしょう。
 
 
=== Root ===
 
 
''root'' の赤/青のプロンプト:
 
 
<div style="font-family: monospace; white-space: pre; padding: 1em; border: 3px solid #bcd; background-color: black; color: #aaa;"><span style="color: #a00">root</span> <span style="color: #00f">~/docs</span> <span style="color: #a00">#</span> <span style="color: #0a0">echo "sample output text"<br />sample output text<br /></span><span style="color: #a00">root</span> <span style="color: #00f">~/docs</span> <span style="color: #a00">#</span> <span style="color: #0a0"><span style="text-decoration: blink;">_</span></span></div>
 
{{bc|<nowiki>PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;31m\]\$ \[\e[m\]\[\e[0;32m\]'</nowiki>}}
 
 
赤色の記号と緑色のコンソールテキストになります。
 
 
== 高度なプロンプト ==
 
 
=== 256色の Load/Mem ステータス ===
 
 
This is not even pushing the limits. Other than using {{ic|sed}} to parse the memory and load average (using the {{ic|-u}} option for non-buffering), and the builtin ''history'' to save your history to your {{ic|HISTFILE}} after every command, which you may find incredibly useful when dealing with crashing shells or subshells, this is essentially just making BASH print variables it already knows, making this extremely fast compared to prompts with non-builtin commands.
 
 
This prompt is from AskApache.com's [http://www.askapache.com/linux-unix/bash-power-prompt.html BASH Power Prompt article], which goes into greater detail. It is especially helpful for those wanting to understand 256 color terminals, ncurses, termcap, and terminfo.
 
 
This is for '''256 color terminals''', which is where the {{ic|\033[38;5;22m}} terminal escapes come from.
 
{{bc|1=
 
<span style="color:#0b0">802</span><span style="color:#005f00">/1024MB</span> <span style="color:#5f00af">1.28 1.20 1.13 3/94 18563</span>
 
<span style="color:#555">[5416:17880 0:70]</span> <span style="color:0bb">05:35:50 Wed Apr 21</span> <span style="color:#555">[</span><span style="color:#2b47ff">srot@host.sqpt.net</span><span style="color:#555">:</span><span style="color:#bbb">/dev/pts/0</span> <span style="color:#00bb00">+1</span><span style="color:#555">]</span> <span style="color:#000">~<br />
 
(1:70)$ <span style="text-decoration: blink;">_</span></span>
 
}}
 
 
{{bc|<nowiki>PROMPT_COMMAND='history -a;echo -en "\033[m\033[38;5;2m"$(( $(sed -nu "s/MemFree:[\t ]\+\([0-9]\+\) kB/\1/p" /proc/meminfo)/1024))"\033[38;5;22m/"$(($(sed -nu "s/MemTotal:[\t ]\+\([0-9]\+\) kB/\1/Ip" /proc/meminfo)/1024 ))MB"\t\033[m\033[38;5;55m$(&lt; /proc/loadavg)\033[m"'
 
PS1='\[\e[m\n\e[1;30m\][$$:$PPID \j:\!\[\e[1;30m\]]\[\e[0;36m\] \T \d \[\e[1;30m\][\[\e[1;34m\]\u@\H\[\e[1;30m\]:\[\e[0;37m\]${SSH_TTY} \[\e[0;32m\]+${SHLVL}\[\e[1;30m\]] \[\e[1;37m\]\w\[\e[0;37m\] \n($SHLVL:\!)\$ '</nowiki>}}
 
 
=== プロンプトと Bash のカラーリスト ===
 
 
以下を Bash ファイルに追加してプロンプトやコマンドの色を定義してください:
 
{{bc|<nowiki>txtblk='\e[0;30m' # Black - Regular
 
txtred='\e[0;31m' # Red
 
txtgrn='\e[0;32m' # Green
 
txtylw='\e[0;33m' # Yellow
 
txtblu='\e[0;34m' # Blue
 
txtpur='\e[0;35m' # Purple
 
txtcyn='\e[0;36m' # Cyan
 
txtwht='\e[0;37m' # White
 
bldblk='\e[1;30m' # Black - Bold
 
bldred='\e[1;31m' # Red
 
bldgrn='\e[1;32m' # Green
 
bldylw='\e[1;33m' # Yellow
 
bldblu='\e[1;34m' # Blue
 
bldpur='\e[1;35m' # Purple
 
bldcyn='\e[1;36m' # Cyan
 
bldwht='\e[1;37m' # White
 
unkblk='\e[4;30m' # Black - Underline
 
undred='\e[4;31m' # Red
 
undgrn='\e[4;32m' # Green
 
undylw='\e[4;33m' # Yellow
 
undblu='\e[4;34m' # Blue
 
undpur='\e[4;35m' # Purple
 
undcyn='\e[4;36m' # Cyan
 
undwht='\e[4;37m' # White
 
bakblk='\e[40m' # Black - Background
 
bakred='\e[41m' # Red
 
bakgrn='\e[42m' # Green
 
bakylw='\e[43m' # Yellow
 
bakblu='\e[44m' # Blue
 
bakpur='\e[45m' # Purple
 
bakcyn='\e[46m' # Cyan
 
bakwht='\e[47m' # White
 
txtrst='\e[0m' # Text Reset</nowiki>}}
 
 
もしくは、特殊なデコーダリングを使うことなくわかりやすい色の名前を使いたい場合、また、彩度が高い色を使いたい場合:
 
{{bc|<nowiki># Reset
 
Color_Off='\e[0m' # Text Reset
 
 
# Regular Colors
 
Black='\e[0;30m' # Black
 
Red='\e[0;31m' # Red
 
Green='\e[0;32m' # Green
 
Yellow='\e[0;33m' # Yellow
 
Blue='\e[0;34m' # Blue
 
Purple='\e[0;35m' # Purple
 
Cyan='\e[0;36m' # Cyan
 
White='\e[0;37m' # White
 
 
# Bold
 
BBlack='\e[1;30m' # Black
 
BRed='\e[1;31m' # Red
 
BGreen='\e[1;32m' # Green
 
BYellow='\e[1;33m' # Yellow
 
BBlue='\e[1;34m' # Blue
 
BPurple='\e[1;35m' # Purple
 
BCyan='\e[1;36m' # Cyan
 
BWhite='\e[1;37m' # White
 
 
# Underline
 
UBlack='\e[4;30m' # Black
 
URed='\e[4;31m' # Red
 
UGreen='\e[4;32m' # Green
 
UYellow='\e[4;33m' # Yellow
 
UBlue='\e[4;34m' # Blue
 
UPurple='\e[4;35m' # Purple
 
UCyan='\e[4;36m' # Cyan
 
UWhite='\e[4;37m' # White
 
 
# Background
 
On_Black='\e[40m' # Black
 
On_Red='\e[41m' # Red
 
On_Green='\e[42m' # Green
 
On_Yellow='\e[43m' # Yellow
 
On_Blue='\e[44m' # Blue
 
On_Purple='\e[45m' # Purple
 
On_Cyan='\e[46m' # Cyan
 
On_White='\e[47m' # White
 
 
# High Intensity
 
IBlack='\e[0;90m' # Black
 
IRed='\e[0;91m' # Red
 
IGreen='\e[0;92m' # Green
 
IYellow='\e[0;93m' # Yellow
 
IBlue='\e[0;94m' # Blue
 
IPurple='\e[0;95m' # Purple
 
ICyan='\e[0;96m' # Cyan
 
IWhite='\e[0;97m' # White
 
 
# Bold High Intensity
 
BIBlack='\e[1;90m' # Black
 
BIRed='\e[1;91m' # Red
 
BIGreen='\e[1;92m' # Green
 
BIYellow='\e[1;93m' # Yellow
 
BIBlue='\e[1;94m' # Blue
 
BIPurple='\e[1;95m' # Purple
 
BICyan='\e[1;96m' # Cyan
 
BIWhite='\e[1;97m' # White
 
 
# High Intensity backgrounds
 
On_IBlack='\e[0;100m' # Black
 
On_IRed='\e[0;101m' # Red
 
On_IGreen='\e[0;102m' # Green
 
On_IYellow='\e[0;103m' # Yellow
 
On_IBlue='\e[0;104m' # Blue
 
On_IPurple='\e[0;105m' # Purple
 
On_ICyan='\e[0;106m' # Cyan
 
On_IWhite='\e[0;107m' # White
 
</nowiki>}}
 
 
シェル環境からコマンドで使うには:
 
 
<div style="font-family: monospace; padding: 1em; border: 3px solid #bcd; background-color: black; color: #fff;">$ echo -e "${txtblu}test"<br /><span style="color: blue;">test</span><br />$ echo -e "${bldblu}test"<br /><span style="color: lightblue;"><strong>test</strong></span><br />$ echo -e "${undblu}test"<br /><span style="color: lightblue;"><strong><span style="text-decoration: underline;">test</span></strong></span><br />$ echo -e "${bakblu}test"<br /><span style="color: white; background-color: lightblue;"><strong>test</strong></span><br />$ <span style="text-decoration: blink;">_</span></div>
 
 
{{bc|<nowiki>PS1="\[$txtblu\]foo\[$txtred\] bar\[$txtrst\] baz : "</nowiki>}}
 
 
Double quotes enable {{ic|$color}} variable expansion and the {{ic|<nowiki>\[ \]</nowiki>}} escapes around them make them not count as character positions and the cursor position is not wrong.
 
 
{{Note|If experiencing premature line wrapping when entering commands, then missing escapes ({{ic|<nowiki>\[ \]</nowiki>}}) is most likely the reason.}}
 
 
=== プロンプトの拡張 ===
 
 
man ページには様々な Bash プロンプトエスケープが載っています:
 
 
{{bc|1=Bash allows these prompt strings to be customized by inserting a
 
number of ''backslash-escaped special characters'' that are
 
decoded as follows:
 
 
\a an ASCII bell character (07)
 
\d the date in "Weekday Month Date" format (e.g., "Tue May 26")
 
\D{format} the format is passed to strftime(3) and the result
 
is inserted into the prompt string an empty format
 
results in a locale-specific time representation.
 
The braces are required
 
\e an ASCII escape character (033)
 
\h the hostname up to the first `.'
 
\H the hostname
 
\j the number of jobs currently managed by the shell
 
\l the basename of the shell's terminal device name
 
\n newline
 
\r carriage return
 
\s the name of the shell, the basename of $0 (the portion following
 
the final slash)
 
\t the current time in 24-hour HH:MM:SS format
 
\T the current time in 12-hour HH:MM:SS format
 
\@ the current time in 12-hour am/pm format
 
\A the current time in 24-hour HH:MM format
 
\u the username of the current user
 
\v the version of bash (e.g., 2.00)
 
\V the release of bash, version + patch level (e.g., 2.00.0)
 
\w the current working directory, with $HOME abbreviated with a tilde
 
\W the basename of the current working directory, with $HOME
 
abbreviated with a tilde
 
\! the history number of this command
 
\# the command number of this command
 
\$ if the effective UID is 0, a #, otherwise a $
 
\nnn the character corresponding to the octal number nnn
 
\\ a backslash
 
\[ begin a sequence of non-printing characters, which could be used
 
to embed a terminal control sequence into the prompt
 
\] end a sequence of non-printing characters
 
 
The command number and the history number are usually different:
 
the history number of a command is its position in the history
 
list, which may include commands restored from the history file
 
(see HISTORY below), while the command number is the position in
 
the sequence of commands executed during the current shell session.
 
After the string is decoded, it is expanded via parameter
 
expansion, command substitution, arithmetic expansion, and quote
 
removal, subject to the value of the promptvars shell option (see
 
the description of the shopt command under SHELL BUILTIN COMMANDS
 
below).
 
}}
 
 
=== カーソルの位置 ===
 
 
以下のシーケンスはカーソルの位置をセットします:
 
 
{{bc|<nowiki>\[\033[<row>;<column>f\]</nowiki>}}
 
 
現在のカーソル位置を保存するには:
 
 
{{bc|<nowiki>\[\033[s\]</nowiki>}}
 
 
位置を復元するには、以下のシーケンスを使用:
 
 
{{bc|<nowiki>\[\033[u\]</nowiki>}}
 
 
下の例は、以上のシーケンスを使って右上のコーナーに時計を表示します:
 
 
{{bc|<nowiki>PS1="&gt;\[\033[s\]\[\033[1;\$((COLUMNS-4))f\]\$(date +%H:%M)\[\033[u\]"</nowiki>}}
 
 
環境変数 {{ic|COLUMNS}} にはターミナルの列の数が入ります。上の例では {{ic|COLUMNS}} から ''4'' を引いて {{ic|date}} の5文字分だけ右端に出力できるように整えています。
 
 
=== 戻り値を視覚的に表現 ===
 
 
以下のプロンプトを使うことで最後に実行したコマンドの返り値をわかりやすくできます:
 
 
<div style="font-family: monospace; padding: 1em; border: 3px solid #bcd; background-color: black; color: #fff;">0 <span style="color: green;">;)</span>&nbsp;: true<br />0 <span style="color: green;">;)</span>&nbsp;: false<br />1 <span style="color: red;">;(</span>&nbsp;:</div>
 
 
{{bc|<nowiki>#return value visualisation
 
PS1="\$? \$(if [[ \$? == 0 ]]; then echo \"\[\033[0;32m\];)\"; else echo \"\[\033[0;31m\];(\"; fi)\[\033[00m\] : "</nowiki>}}
 
 
''Zero'' は緑のスマイリーで ''non-zero'' は赤になります。最後の操作が成功したならばプロンプトは微笑みます。
 
 
以下のようにユーザー名とホスト名を含めても良いでしょう:
 
 
<div style="font-family: monospace; padding: 1em; border: 3px solid #bcd; background-color: black; color: #fff;"><span style="font-weight: bold;">0</span> <span style="color: #0a0; font-weight: bold;">;) andy@alba</span> <span style="color: #55f; font-weight: bold;">~ $</span> true<br /><span style="font-weight: bold;">0</span> <span style="color: #0a0; font-weight: bold;">;) andy@alba</span> <span style="color: #55f; font-weight: bold;">~ $</span> false<br /><span style="font-weight: bold;">1</span> <span style="color: #a00; font-weight: bold;">;(</span> <span style="color: #0a0; font-weight: bold;">andy@alba</span> <span style="color: #55f; font-weight: bold;">~ $</span> <span style="text-decoration: blink;">_</span></div>
 
 
{{bc|<nowiki>#return value visualisation
 
PS1="\[\033[01;37m\]\$? \$(if [[ \$? == 0 ]]; then echo \"\[\033[01;32m\];)\"; else echo \"\[\033[01;31m\];(\"; fi) $(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;32m\]\u@\h'; fi)\[\033[01;34m\] \w \$\[\033[00m\] "</nowiki>}}
 
 
また、宜しければ、''zero'' ステータスのときは <span style="color: #0a0; font-weight: bold;">&#10003;</span> ユニコード記号を、''nonzero'' ステータスのときは <span style="color: #a00; font-weight: bold;">&#10007;</span> ユニコード記号を使ってプロンプトを構築することもできます:
 
 
<div style="font-family: monospace; padding: 1em; border: 3px solid #bcd; background-color: black; color: #fff;"><span style="font-weight: bold;">0</span> <span style="color: #0a0; font-weight: bold;">&#10003; andy@alba</span> <span style="color: #55f; font-weight: bold;">~ $</span> true<br /><span style="font-weight: bold;">0</span> <span style="color: #0a0; font-weight: bold;">&#10003; andy@alba</span> <span style="color: #55f; font-weight: bold;">~ $</span> false<br /><span style="font-weight: bold;">1</span> <span style="color: #a00; font-weight: bold;">&#10007;</span> <span style="color: #0a0; font-weight: bold;">andy@alba</span> <span style="color: #55f; font-weight: bold;">~ $</span> I\ will\ try\ to\ type\ a\ wrong\ command...<br />bash: I will try to type a wrong command...: command not found<br /><span style="font-weight: bold;">127</span> <span style="color: #a00; font-weight: bold;">&#10007;</span> <span style="color: #0a0; font-weight: bold;">andy@alba</span> <span style="color: #55f; font-weight: bold;">~ $</span> <span style="text-decoration: blink;">_</span></div>
 
 
{{bc|<nowiki>#return value visualisation
 
PS1="\[\033[01;37m\]\$? \$(if [[ \$? == 0 ]]; then echo \"\[\033[01;32m\]\342\234\223\"; else echo \"\[\033[01;31m\]\342\234\227\"; fi) $(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;32m\]\u@\h'; fi)\[\033[01;34m\] \w \$\[\033[00m\] "</nowiki>}}
 
 
さらに、{{ic|PROMPT_COMMAND}} で [http://stackoverflow.com/a/22362727/1821548 可読性] を向上させることができます:
 
 
{{bc|<nowiki>set_prompt () {
 
Last_Command=$? # Must come first!
 
Blue='\[\e[01;34m\]'
 
White='\[\e[01;37m\]'
 
Red='\[\e[01;31m\]'
 
Green='\[\e[01;32m\]'
 
Reset='\[\e[00m\]'
 
FancyX='\342\234\227'
 
Checkmark='\342\234\223'
 
 
# Add a bright white exit status for the last command
 
PS1="$White\$? "
 
# If it was successful, print a green check mark. Otherwise, print
 
# a red X.
 
if [[ $Last_Command == 0 ]]; then
 
PS1+="$Green$Checkmark "
 
else
 
PS1+="$Red$FancyX "
 
fi
 
# If root, just print the host in red. Otherwise, print the current user
 
# and host in green.
 
if [[ $EUID == 0 ]]; then
 
PS1+="$Red\\h "
 
else
 
PS1+="$Green\\u@\\h "
 
fi
 
# Print the working directory and prompt marker in blue, and reset
 
# the text color to the default.
 
PS1+="$Blue\\w \\\$$Reset "
 
}
 
PROMPT_COMMAND='set_prompt'</nowiki>}}
 
 
以下は ''non-zero'' の場合に、エラーステータスだけを含める設定です:
 
{{bc|<nowiki>
 
PROMPT_COMMAND='es=$?; [[ $es -eq 0 ]] &amp;&amp; unset error || error=$(echo -e "\e[1;41m $es \e[40m")'
 
PS1="${error} ${PS1}"</nowiki>}}
 
 
== Tips and tricks ==
 
 
=== テキストエントリとコンソールの出力で別の色を使う ===
 
 
If you do not reset the text color at the end of your prompt, both the text you enter and the console text will simply stay in that color. If you want to edit text in a special color but still use the default color for command output, you will need to reset the color after you press {{ic|Enter}}, but still before any commands get run. You can do this by installing a DEBUG trap, like this:
 
 
{{hc|~/.bashrc|
 
<nowiki>trap 'echo -ne "\e[0m"' DEBUG</nowiki>}}
 
 
=== ログイン時にランダムで名言を表示 ===
 
 
褐色の [[Fortune]] プロンプトを表示するには、以下を追加:
 
 
{{hc|~/.bashrc|<nowiki>
 
[[ "$PS1" ]] && echo -e "\e[00;33m$(/usr/bin/fortune)\e[00m"
 
</nowiki>}}
 
 
=== ログイン時に Arch の最新ニュースをカラーで表示 ===
 
 
[https://www.archlinux.org/news/ Arch 公式ウェブサイト]から最新のニュースアイテム10件を読み込む、小さなカラーの RSS 拡張スクリプト (ユーザー [https://aur.archlinux.org/account.php?Action=AccountInfo&ID=33208 grufo] の[https://bbs.archlinux.org/viewtopic.php?id=146850 作品]):
 
 
<div style="height: 350px; overflow: auto; font-family: monospace; padding: 1em; border: 3px solid #bbccdd; background-color: black; color: #aaaaaa;">&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">Arch Linux: Recent news updates</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br />The latest and greatest news from the Arch Linux distribution.<br /><br />&nbsp;<span style="color: #aa0000; font-weight: bold;">en-us Sun, 04 Nov 2012 16:09:46 +0000</span><br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">End of initscripts support</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/end-of-initscripts-support/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Tom Gundersen wrote:<br />As <span style="color: #ffffff;">systemd</span> is now the default init system, Arch Linux is receiving minimal testing on initscripts systems. Due to a lack of resources and interest, we are unlikely to work on fixing <span style="color: #ffffff;">initscripts</span>-specific bugs, and may close them as WONTFIX.<br />We therefore strongly encourage all users to migrate to <span style="color: #ffffff;">systemd</span> as soon as possible. See the <span style="color: #ffffff;">systemd</span> migration guide <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://wiki.archlinux.org/index.php/Systemd</nowiki></span> <span style="color: #5555ff;">]</span>.<br />To ease the transition, <span style="color: #ffffff;">initscripts</span> support will remain in the official repositories for the time being, unless otherwise stated. As of January 2013, we will start removing <span style="color: #ffffff;">initscripts</span> support (e.g., <span style="color: #ffffff;">rc</span> scripts) from individual packages without further notice.<br /><br />&nbsp;<span style="color: #ffffff;">Tom Gundersen Sun, 04 Nov 2012 16:09:46 +0000 tag:www.archlinux.org,2012-11-04:/news/end-of-initscripts-support/</span><br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">November release of install media available</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/november-release-of-install-media-available/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Pierre Schmitz wrote:<br />The latest snapshot of our install and rescue media can be found on our <span style="color: #aa0000; font-weight: bold;">Download</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://www.archlinux.org/download/</nowiki></span> <span style="color: #5555ff;">]</span> page. The 2012.11.01 ISO image mainly contains minor bug fixes, cleanups and new packages compared to the previous one:<br />&nbsp;<span style="color: #5555ff;">*</span> First media with Linux 3.6<br />&nbsp;<span style="color: #5555ff;">*</span> <span style="background-color: #aa0000;">copytoram=n</span> can be used to not copy the image to RAM on network boot. This is probably unreliable but an option for systems with very low memory.<br />&nbsp;<span style="color: #5555ff;">*</span> <span style="background-color: #aa0000;">cowfile_size</span> boot parameter mainly for persistent COW on VFAT. See the <span style="color: #aa0000; font-weight: bold;">README</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://projects.archlinux.org/archiso.git/plain/docs/README.bootparams?id=v4</nowiki></span> <span style="color: #5555ff;">]</span> file for details.<br /><br />&nbsp;<span style="color: #ffffff;">Pierre Schmitz Fri, 02 Nov 2012 17:54:15 +0000 tag:www.archlinux.org,2012-11-02:/news/november-release-of-install-media-available/</span><br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">Bug Squashing Day: Saturday 17th November</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/bug-squashing-day-saturday-17th-november/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Allan McRae wrote:<br />The number of bugs in the Arch Linux bug tracker is creeping up so it is time for some extermination.<br />This is a great way for the community to get involved and help the Arch Linux team. The process is simple. First look at a bug for your favorite piece of software in the bug tracker and check if it still occurs. If it does, check the upstream project for a fix and test it to confirm it works. If there is no fix available, make sure the bug has been filed in the upstream tracker.<br />Join us on the #archlinux-bugs IRC channel. We are spread across timezones, so people should be around all day.<br /><br />&nbsp;<span style="color: #ffffff;">Allan McRae Thu, 01 Nov 2012 12:28:51 +0000 tag:www.archlinux.org,2012-11-01:/news/bug-squashing-day-saturday-17th-november/</span><br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">ConsoleKit replaced by logind</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/consolekit-replaced-by-logind/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Allan McRae wrote:<br />With GNOME 3.6, polkit and networkmanager moving to [extra], ConsoleKit has now been removed from the repositories. Any package that previously depended on it now relies on systemd-logind instead. That means that the system must be booted with systemd to be fully functional.<br />In addition to GNOME, both KDE and XFCE are also affected by this change.<br /><br />&nbsp;<span style="color: #ffffff;">Allan McRae Tue, 30 Oct 2012 22:17:39 +0000 tag:www.archlinux.org,2012-10-30:/news/consolekit-replaced-by-logind/</span><br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">systemd is now the default on new installations</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/systemd-is-now-the-default-on-new-installations/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Thomas B&auml;chler wrote:<br />The base group now contains the <span style="color: #ffffff;">systemd-sysvcompat</span> package. This means that all new installations will boot with systemd by default.<br />As some packages still lack native systemd units, users can install the <span style="color: #ffffff;">initscripts</span> package and use the <span style="color: #ffffff;">DAEMONS</span> array in <span style="color: #ffffff;">/etc/rc.conf</span> to start services using the legacy rc.d scripts.<br />This change does not affect existing installations. For the time being, the <span style="color: #ffffff;">initscripts</span> and <span style="color: #ffffff;">sysvinit</span> packages remain available from our repositories. However, individual packages may now start relying on the system being booted with systemd.<br />Please refer to <span style="color: #aa0000; font-weight: bold;">the wiki</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://wiki.archlinux.org/index.php/Systemd</nowiki></span> <span style="color: #5555ff;">]</span> for how to transition an existing installation to systemd.<br /><br />&nbsp;<span style="color: #ffffff;">Thomas B&auml;chler Sat, 13 Oct 2012 09:29:38 +0000 tag:www.archlinux.org,2012-10-13:/news/systemd-is-now-the-default-on-new-installations/</span><br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">Install medium 2012.10.06 introduces systemd</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/install-medium-20121006-introduces-systemd/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Pierre Schmitz wrote:<br />The October release of the Arch Linux install medium is available for <span style="color: #aa0000; font-weight: bold;">Download</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://www.archlinux.org/download/</nowiki></span> <span style="color: #5555ff;">]</span> and can be used for new installs or as a rescue system. It contains a set of updated packages and the following notable changes:<br />&nbsp;<span style="color: #5555ff;">*</span> systemd is used to boot up the live system.<br />&nbsp;<span style="color: #5555ff;">*</span> initscripts are no longer available on the live system but are still installed by default on the target system. This is likely to change in the near future.<br />&nbsp;<span style="color: #5555ff;">*</span> EFI boot and setup has been simplified.<br />&nbsp;<span style="color: #5555ff;">*</span> gummiboot is used to display a menu on EFI systems.<br />&nbsp;<span style="color: #5555ff;">*</span> The following new packages are available on the live system: ethtool, fsarchiver, gummiboot-efi, mc, partclone, partimage, refind-efi, rfkill, sudo, testdisk, wget, xl2tpd<br /><br />&nbsp;<span style="color: #ffffff;">Pierre Schmitz Sun, 07 Oct 2012 16:58:03 +0000 tag:www.archlinux.org,2012-10-07:/news/install-medium-20121006-introduces-systemd/</span><br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">New install medium 2012.09.07</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/new-install-medium-20120907/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Pierre Schmitz wrote:<br />As is customary by now there is a new install medium available at the beginning of this month. The live system can be downloaded from <span style="color: #aa0000; font-weight: bold;">Download</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://www.archlinux.org/download/</nowiki></span> <span style="color: #5555ff;">]</span> and be used for new installs or as a rescue system.<br />In addition to a couple of updated packages and bug fixes the following changes stand out:<br />&nbsp;<span style="color: #5555ff;">*</span> First medium with Linux 3.5 (3.5.3)<br />&nbsp;<span style="color: #5555ff;">*</span> The <span style="background-color: #aa0000;">script</span> boot parameter works again (<span style="color: #aa0000; font-weight: bold;">FS#31022</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://bugs.archlinux.org/task/31022</nowiki></span> <span style="color: #5555ff;">]</span>)<br />&nbsp;<span style="color: #5555ff;">*</span> When booting via PXE and NFS or NBD the ISO will be copied to RAM to ensure a more stable usage.<br />&nbsp;<span style="color: #5555ff;">*</span> The live medium contains <span style="background-color: #aa0000;">usb_modeswitch</span> and <span style="background-color: #aa0000;">wvdial</span> which e.g. allows to establish a network connection using an UMTS USB dongle<br />&nbsp;<span style="color: #5555ff;">*</span> Furthermore the newest versions of <span style="background-color: #aa0000;">initscripts</span>, <span style="background-color: #aa0000;">systemd</span> and <span style="background-color: #aa0000;">netcfg</span> are included.<br /><br />&nbsp;<span style="color: #ffffff;">Pierre Schmitz Sat, 08 Sep 2012 09:48:52 +0000 tag:www.archlinux.org,2012-09-08:/news/new-install-medium-20120907/</span><br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">Fontconfig 2.10.1 update - manual intervention required</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/fontconfig-2101-update-manual-intervention-required/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Andreas Radke wrote:<br />The fontconfig 2.10.1 update overwrites symlinks created by the former package version. These symlinks need to be removed before the update:<br /><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/20-unhint-small-vera.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/20-fix-globaladvance.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/29-replace-bitmap-fonts.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/30-metric-aliases.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/30-urw-aliases.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/40-nonlatin.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/45-latin.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/49-sansserif.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/50-user.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/51-local.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/60-latin.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/65-fonts-persian.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/65-nonlatin.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/69-unifont.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/80-delicious.conf</span><br /><span style="color: #ffffff;">rm /etc/fonts/conf.d/90-synthetic.conf</span><br /><span style="color: #ffffff;">pacman -Syu fontconfig</span><br /><br />Main systemwide configuration should be done by symlinks (especially for autohinting, sub-pixel and lcdfilter):<br /><br /><span style="color: #ffffff;">cd /etc/fonts/conf.d</span><br /><span style="color: #ffffff;">ln -s ../conf.avail/XX-foo.conf</span><br /><br />Also check <span style="color: #aa0000; font-weight: bold;">Font Configuration</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://wiki.archlinux.org/index.php/Font_Configuration</nowiki></span> <span style="color: #5555ff;">]</span> and <span style="color: #aa0000; font-weight: bold;">Fonts</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://wiki.archlinux.org/index.php/Fonts</nowiki></span> <span style="color: #5555ff;">]</span>.<br /><br />&nbsp;<span style="color: #ffffff;">Andreas Radke Thu, 06 Sep 2012 13:54:23 +0000 tag:www.archlinux.org,2012-09-06:/news/fontconfig-2101-update-manual-intervention-required/</span><br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">netcfg-2.8.9 drops deprecated rc.conf compatibility</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/netcfg-289-drops-initscripts-compatibility/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Florian Pritz wrote:<br />Users of <span style="color: #ffffff;">netcfg</span> should configure all interfaces in <span style="color: #ffffff;">/etc/conf.d/netcfg</span> rather than <span style="color: #ffffff;">/etc/rc.conf</span>.<br /><br />&nbsp;Florian Pritz Sat, 11 Aug 2012 20:00:02 +0000 tag:www.archlinux.org,2012-08-11:/news/netcfg-289-drops-initscripts-compatibility/<br /><br /><br />&nbsp;&nbsp; <span style="color: #ffffff; font-weight: bold;">::</span> <span style="color: #aa0000; font-weight: bold;">Install media 2012.08.04 available</span> <span style="color: #ffffff; font-weight: bold;">::</span><br />&nbsp;<span style="color: #ffffff;">[</span> <span style="color: #55ccff; font-weight: bold;"><nowiki>https://www.archlinux.org/news/install-media-20120804-available/</nowiki></span> <span style="color: #ffffff;">]</span><br /><br /><br />Pierre Schmitz wrote:<br />The August snapshot of our live and install media comes with updated packages and the following changes on top of the <span style="color: #aa0000; font-weight: bold;">previous ISO image</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;">/news/install-media-20120715-released/</span> <span style="color: #5555ff;">]</span>:<br />&nbsp;<span style="color: #5555ff;">*</span> GRUB 2.0 instead of the legacy 0.9 version is available.<br />&nbsp;<span style="color: #5555ff;">*</span> The <span style="color: #aa0000; font-weight: bold;">Installation Guide</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>https://wiki.archlinux.org/index.php/Installation_Guide</nowiki></span> <span style="color: #5555ff;">]</span> can be found at <span style="background-color: #aa0000;">/root/install.txt</span>.<br />&nbsp;<span style="color: #5555ff;">*</span> ZSH with <span style="color: #aa0000; font-weight: bold;">Grml's configuration</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;"><nowiki>http://grml.org/zsh/</nowiki></span> <span style="color: #5555ff;">]</span> is used as interactive shell to provide a user friendly and more convenient environment. This includes completion support for pacstrap, arch-chroot, pacman and most other tools.<br />&nbsp;<span style="color: #5555ff;">*</span> The network daemon is started by default which will automatically setup your network if DHCP is available.<br />Note that all these changes only affect the live system and not the base system you install using pacstrap. The ISO image can be downloaded from our <span style="color: #aa0000; font-weight: bold;">download page</span> <span style="color: #5555ff;">[</span> <span style="text-decoration: underline;">/download/</span> <span style="color: #5555ff;">]</span>. The next snapshot is scheduled for September.<br /><br />&nbsp;<span style="color: #ffffff;">Pierre Schmitz Sat, 04 Aug 2012 17:24:30 +0000 tag:www.archlinux.org,2012-08-04:/news/install-media-20120804-available/</span><br /><br /><br /><span style="color: #0a0; font-weight: bold;">andy@alba</span> <span style="text-decoration: blink;">_</span></div>
 
 
{{hc|~/.bashrc|
 
<nowiki># Arch latest news
 
if [ "$PS1" ] && [[ $(ping -c1 www.google.com 2>&-) ]]; then
 
# The characters "&pound;, &sect;" are used as metacharacters. They should not be encountered in a feed...
 
echo -e "$(echo $(curl --silent https://www.archlinux.org/feeds/news/ | sed -e ':a;N;$!ba;s/\n/ /g') | \
 
sed -e 's/&amp;amp;/\&amp;/g
 
s/&amp;lt;\|&amp;#60;/&lt;/g
 
s/&amp;gt;\|&amp;#62;/&gt;/g
 
s/&lt;\/a&gt;/&pound;/g
 
s/href\=\"/&sect;/g
 
s/&lt;title&gt;/\\n\\n\\n :: \\e[01;31m/g; s/&lt;\/title&gt;/\\e[00m ::\\n/g
 
s/&lt;link&gt;/ [ \\e[01;36m/g; s/&lt;\/link&gt;/\\e[00m ]/g
 
s/&lt;description&gt;/\\n\\n\\e[00;37m/g; s/&lt;\/description&gt;/\\e[00m\\n\\n/g
 
s/&lt;p\( [^&gt;]*\)\?&gt;\|&lt;br\s*\/\?&gt;/\n/g
 
s/&lt;b\( [^&gt;]*\)\?&gt;\|&lt;strong\( [^&gt;]*\)\?&gt;/\\e[01;30m/g; s/&lt;\/b&gt;\|&lt;\/strong&gt;/\\e[00;37m/g
 
s/&lt;i\( [^&gt;]*\)\?&gt;\|&lt;em\( [^&gt;]*\)\?&gt;/\\e[41;37m/g; s/&lt;\/i&gt;\|&lt;\/em&gt;/\\e[00;37m/g
 
s/&lt;u\( [^&gt;]*\)\?&gt;/\\e[4;37m/g; s/&lt;\/u&gt;/\\e[00;37m/g
 
s/&lt;code\( [^&gt;]*\)\?&gt;/\\e[00m/g; s/&lt;\/code&gt;/\\e[00;37m/g
 
s/&lt;a[^&sect;|t]*&sect;\([^\"]*\)\"[^&gt;]*&gt;\([^&pound;]*\)[^&pound;]*&pound;/\\e[01;31m\2\\e[00;37m \\e[01;34m[\\e[00;37m \\e[04m\1\\e[00;37m\\e[01;34m ]\\e[00;37m/g
 
s/&lt;li\( [^&gt;]*\)\?&gt;/\n \\e[01;34m*\\e[00;37m /g
 
s/&lt;!\[CDATA\[\|\]\]&gt;//g
 
s/\|&gt;\s*&lt;//g
 
s/ *&lt;[^&gt;]\+&gt; */ /g
 
s/[&lt;&gt;&pound;&sect;]//g')\n\n";
 
fi</nowiki>}}
 
 
一番最新のアイテムだけを表示したい場合は、以下を使用:
 
 
{{bc|<nowiki># Arch latest news
 
if [ "$PS1" ] && [[ $(ping -c1 www.google.com 2>&-) ]]; then
 
# The characters "&pound;, &sect;" are used as metacharacters. They should not be encountered in a feed...
 
echo -e "$(echo $(curl --silent https://www.archlinux.org/feeds/news/ | awk ' NR == 1 {while ($0 !~ /<\/item>/) {print;getline} sub(/<\/item>.*/,"</item>") ;print}' | sed -e ':a;N;$!ba;s/\n/ /g') | \
 
sed -e 's/&amp;amp;/\&amp;/g
 
s/&amp;lt;\|&amp;#60;/&lt;/g
 
s/&amp;gt;\|&amp;#62;/&gt;/g
 
s/&lt;\/a&gt;/&pound;/g
 
s/href\=\"/&sect;/g
 
s/&lt;title&gt;/\\n\\n\\n :: \\e[01;31m/g; s/&lt;\/title&gt;/\\e[00m ::\\n/g
 
s/&lt;link&gt;/ [ \\e[01;36m/g; s/&lt;\/link&gt;/\\e[00m ]/g
 
s/&lt;description&gt;/\\n\\n\\e[00;37m/g; s/&lt;\/description&gt;/\\e[00m\\n\\n/g
 
s/&lt;p\( [^&gt;]*\)\?&gt;\|&lt;br\s*\/\?&gt;/\n/g
 
s/&lt;b\( [^&gt;]*\)\?&gt;\|&lt;strong\( [^&gt;]*\)\?&gt;/\\e[01;30m/g; s/&lt;\/b&gt;\|&lt;\/strong&gt;/\\e[00;37m/g
 
s/&lt;i\( [^&gt;]*\)\?&gt;\|&lt;em\( [^&gt;]*\)\?&gt;/\\e[41;37m/g; s/&lt;\/i&gt;\|&lt;\/em&gt;/\\e[00;37m/g
 
s/&lt;u\( [^&gt;]*\)\?&gt;/\\e[4;37m/g; s/&lt;\/u&gt;/\\e[00;37m/g
 
s/&lt;code\( [^&gt;]*\)\?&gt;/\\e[00m/g; s/&lt;\/code&gt;/\\e[00;37m/g
 
s/&lt;a[^&sect;|t]*&sect;\([^\"]*\)\"[^&gt;]*&gt;\([^&pound;]*\)[^&pound;]*&pound;/\\e[01;31m\2\\e[00;37m \\e[01;34m[\\e[00;37m \\e[04m\1\\e[00;37m\\e[01;34m ]\\e[00;37m/g
 
s/&lt;li\( [^&gt;]*\)\?&gt;/\n \\e[01;34m*\\e[00;37m /g
 
s/&lt;!\[CDATA\[\|\]\]&gt;//g
 
s/\|&gt;\s*&lt;//g
 
s/ *&lt;[^&gt;]\+&gt; */ /g
 
s/[&lt;&gt;&pound;&sect;]//g')\n\n";
 
fi</nowiki>}}
 
 
=== カラー表 ===
 
 
http://ascii-table.com/ansi-escape-sequences.php のページには様々なカラーエスケープが載っています。以下の Bash 関数はすぐにコピーできるエスケープコードの表を表示します:
 
 
{{hc|~/.bashrc|<nowiki>
 
colors() {
 
local fgc bgc vals seq0
 
 
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
 
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
 
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
 
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
 
 
# foreground colors
 
for fgc in {30..37}; do
 
# background colors
 
for bgc in {40..47}; do
 
fgc=${fgc#37} # white
 
bgc=${bgc#40} # black
 
 
vals="${fgc:+$fgc;}${bgc}"
 
vals=${vals%%;}
 
 
seq0="${vals:+\e[${vals}m}"
 
printf " %-9s" "${seq0:-(default)}"
 
printf " ${seq0}TEXT\e[m"
 
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
 
done
 
echo; echo
 
done
 
}
 
</nowiki>}}
 
 
=== git プロンプトのカラー化 ===
 
 
シェルで {{ic|/usr/share/git/completion/git-prompt.sh}} を source してください:
 
 
{{hc|~/.bashrc|
 
source /usr/share/git/completion/git-prompt.sh
 
}}
 
 
そして {{ic|PS1}} や {{ic|PROMPT_COMMAND}} の中で {{ic|__git_ps1}} を使って下さい。詳しくは [http://ithaca.arpinum.org/2013/01/02/git-prompt.html Don't Reinvent the Wheel] を参照。
 
 
== 参照 ==
 
 
全てイチから自力でスタイルを作成したい場合は、以下のページを見ると参考になります:
 
 
* フォーラムスレッドに投稿されたサンプルやスクリーンショット: [https://bbs.archlinux.org/viewtopic.php?id=50885 What's your PS1?]
 
* 元の''修正が加えられていない'' Gentoo の {{ic|/etc/bash.bashrc}} ファイルは [http://www.jeremysands.com/archlinux/gentoo-bashrc-2008.0 ここ]{{Dead link|2014|08|05}} にあります。[[AUR (日本語)|AUR]] の {{AUR|gentoo-bashrc}} パッケージも見て下さい。
 
* tput(1)
 
** [http://wiki.bash-hackers.org/scripting/terminalcodes tput reference on bash-hackers.org]
 
** [http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html Colours and Cursor Movement With tput]
 
* [http://xcolors.net/ Nice Xresources color schemes collection]
 
* [http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html Bash Prompt HOWTO]
 
* [http://gilesorr.com/bashprompt/prompts/index.html Giles Orr's collection of sample prompts]
 
* [http://misc.flogisoft.com/bash/tip_colors_and_formatting Bash tips: Colors and formatting]
 

2016年11月12日 (土) 19:56時点における最新版