From 6a49909b52b48592234da6a53bfe74ea34c302c6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 30 Apr 2014 14:24:24 -0700 Subject: CodingGuidelines: give an example for redirection Signed-off-by: Junio C Hamano --- Documentation/CodingGuidelines | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 169b4358c9..11704fb84c 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 "$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. -- cgit v1.2.3