コンテンツにスキップ

「DeveloperWiki:Bash コーディングスタイル」の版間の差分

提供: ArchWiki
削除された内容 追加された内容
 
アーカイブ化
タグ: 新規リダイレクト
 
(他の1人の利用者による、間の3版が非表示)
1行目: 1行目:
# en:DeveloperWiki:Bash Coding Style


#redirect [[ArchWiki:アーカイブ]]
[[Category:Arch development]]
[[Category:アーカイブ]]
{{Note|The style on this page applies to Arch Linux software projects, not code snippets on ArchWiki articles.}}

== Policy ==

* encoding is utf-8
* use {{ic|#!/bin/bash}}
* indent with tabs
* tabs have 8 characters
* do not use more than 132 columns
* opening braces are top right, closing are bottom left:
<pre>
foo() {
echo bar
}
</pre>
* {{ic|if}} and {{ic|for}} statements are like this:
<pre>
if true; then
do something
else
do something else
fi
</pre>
<pre>
for i in a b c; do
echo $i
done
</pre>
* use single quotes if a string does not contain parseable content
* use {{ic|source}} instead of {{ic|.}}
* use {{ic|$()}} instead of {{ic|``}}

2023年9月2日 (土) 18:10時点における最新版