Difference between revisions of "DeveloperWiki:Bash Coding Style"

From ArchWiki
Jump to: navigation, search
m (" don't " -> " do not ")
Line 1: Line 1:
[[Category:Arch development (English)]]
[[Category:Arch development]]
* encoding is utf-8
* encoding is utf-8

Revision as of 10:57, 23 April 2012


  • encoding is utf-8
  • use #!/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:
foo() {
        echo bar
  • if and for statements are like this:
if true; then
        do something
        do something else
for i in a b c; do
        echo $i
  • use single quotes if a string does not contain parseable content
  • use source instead of .