summaryrefslogtreecommitdiff
path: root/Documentation/CodingGuidelines
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-04-30 21:24:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-05-02 20:24:57 (GMT)
commit6a49909b52b48592234da6a53bfe74ea34c302c6 (patch)
tree77ccd75772931015ed6c70f9c0ec3bdfaca99ea3 /Documentation/CodingGuidelines
parent79fc3ca1232099fd21e5bdef14c1b6fe1d2dbc1c (diff)
downloadgit-6a49909b52b48592234da6a53bfe74ea34c302c6.zip
git-6a49909b52b48592234da6a53bfe74ea34c302c6.tar.gz
git-6a49909b52b48592234da6a53bfe74ea34c302c6.tar.bz2
CodingGuidelines: give an example for redirection
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/CodingGuidelines')
-rw-r--r--Documentation/CodingGuidelines8
1 files changed, 8 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 169b435..11704fb 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -61,6 +61,14 @@ For shell scripts specifically (not exhaustive):
redirection target in a variable (as shown above), our code does so
because some versions of bash issue a warning without the quotes.
+ (incorrect)
+ cat hello > world < universe
+ echo hello >$world
+
+ (correct)
+ cat hello >world <universe
+ echo hello >"$world"
+
- 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.