From: Junio C Hamano Date: Wed, 30 Apr 2014 21:45:07 GMT Subject: [PATCH 3/8] CodingGuidelines: give an example for redirection Message-ID: <1398894312-30763-4-git-send-email-gitster@pobox.com> In-Reply-To: <1398894312-30763-1-git-send-email-gitster@pobox.com> Signed-off-by: Junio C Hamano --- Documentation/CodingGuidelines | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 9b103cb..1e0c4cf 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -53,6 +53,12 @@ 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. + cat hello > world < universe # incorrect + cat hello >world $world # incorrect + echo hello >"$world" # correct + - 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. -- 2.0.0-rc1-355-gd6d6511