diff options
author | Jiang Xin <worldhello.net@gmail.com> | 2012-02-28 12:23:26 +0800 |
---|---|---|
committer | Jiang Xin <worldhello.net@gmail.com> | 2012-02-28 12:23:26 +0800 |
commit | 508d1244dc8d38188c70e98207efa8a97d16b47c (patch) | |
tree | fc8688b80be453755f8135df11bf1db2d247725a /Documentation/CodingGuidelines | |
parent | 0ad9e96d2e2f42f4d2ce7cd612bf741913242bc0 (diff) | |
parent | 25a7850a106ed0f27b88b8ce0b89fd326120dff4 (diff) | |
download | git-508d1244dc8d38188c70e98207efa8a97d16b47c.tar.gz git-508d1244dc8d38188c70e98207efa8a97d16b47c.tar.xz |
Merge branch 'master' into git-po
Diffstat (limited to 'Documentation/CodingGuidelines')
-rw-r--r-- | Documentation/CodingGuidelines | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 483008699..45577117c 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -35,10 +35,22 @@ For shell scripts specifically (not exhaustive): - Case arms are indented at the same depth as case and esac lines. + - Redirection operators should be written with space before, but no + space after them. In other words, write 'echo test >"$file"' + instead of 'echo test> $file' or 'echo test > $file'. Note that + even though it is not required by POSIX to double-quote the + redirection target in a variable (as shown above), our code does so + because some versions of bash issue a warning without the quotes. + - We prefer $( ... ) for command substitution; unlike ``, it properly nests. It should have been the way Bourne spelled it from day one, but unfortunately isn't. + - If you want to find out if a command is available on the user's + $PATH, you should use 'type <command>', instead of 'which <command>'. + The output of 'which' is not machine parseable and its exit code + is not reliable across platforms. + - We use POSIX compliant parameter substitutions and avoid bashisms; namely: |