From: Tim Henigan <tim.henigan@gmail.com>
To: git@vger.kernel.org, gitster@pobox.com
Cc: tim.henigan@gmail.com
Subject: [PATCH v2 1/2] CodingGuidelines: Add a note about spaces after redirection
Date: Fri, 24 Feb 2012 18:12:57 -0500 [thread overview]
Message-ID: <1330125178-9194-1-git-send-email-tim.henigan@gmail.com> (raw)
During code review of some patches, it was noted that redirection operators
should have space before, but no space after them.
Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
---
Updated to include double-quotes around redirection target and also
document why they are needed.
Documentation/CodingGuidelines | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 4830086..5a190b9 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -35,6 +35,16 @@ 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. For example:
+ 'echo test >"$file"' is preferred over
+ '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 them.
+
- 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.
--
1.7.9.1
next reply other threads:[~2012-02-27 19:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-24 23:12 Tim Henigan [this message]
2012-02-24 23:12 ` [PATCH v2 2/2] CodingGuidelines: Add note forbidding use of 'which' in shell scripts Tim Henigan
2012-02-27 20:55 ` [PATCH v2 1/2] CodingGuidelines: Add a note about spaces after redirection Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330125178-9194-1-git-send-email-tim.henigan@gmail.com \
--to=tim.henigan@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).