[PATCH v2 3/8] CodingGuidelines: give an example for redirection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---

 * Instead of using trailing "# correct" comment on each of the
   one-liners, group the good ones and the bad ones into two groups
   and give (incorrect)/(correct) header like the other patches as
   suggested.  How does this look?

   The only reason I originally did these differently is because
   these are two independent examples, and I thought it would make
   the difference stand out better to the readers if we showed
   good/bad pairs of "cat" and "echo" that way.  But as long as we
   are not going to add more examples here, I think the result is
   not too bad.

 Documentation/CodingGuidelines | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 6a8e94b..6bfe96e 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.
-- 
2.0.0-rc1-355-gd6d6511
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]