git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 30, 2014, 21:45 UTC
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 <gitster@pobox.com>
---
 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 <universe	# correct
+
+	echo hello >$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
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 30 in “Update the CodingGuidelines”
  1. 0/8 Update the CodingGuidelinesJunio C Hamano, Apr 30, 2014
  2. 1/8 CodingGuidelines: typofixJunio C Hamano, Apr 30, 2014
  3. David KastrupMay 1, 2014
  4. Junio C HamanoMay 1, 2014
  5. Jeff KingMay 1, 2014
  6. Junio C HamanoMay 2, 2014
  7. Jeff KingMay 2, 2014
  8. Felipe ContrerasMay 2, 2014
  9. David KastrupMay 2, 2014
  10. 2/8 CodingGuidelines: give an example for case/esac statementJunio C Hamano, Apr 30, 2014
  11. 3/8 CodingGuidelines: give an example for redirectionJunio C Hamano, Apr 30, 2014
  12. 3/8 CodingGuidelines: give an example for redirectionJunio C Hamano, Apr 30, 2014
  13. 4/8 CodingGuidelines: give an example for control statementsJunio C Hamano, Apr 30, 2014
  14. Stefan BellerApr 30, 2014
  15. Junio C HamanoApr 30, 2014
  16. David KastrupMay 1, 2014
  17. Junio C HamanoMay 1, 2014
  18. 5/8 CodingGuidelines: give an example for shell function preambleJunio C Hamano, Apr 30, 2014
  19. 6/8 CodingGuidelines: call the conditional statement "if ()", not "if()"Junio C Hamano, Apr 30, 2014
  20. David KastrupMay 1, 2014
  21. Junio C HamanoMay 1, 2014
  22. David KastrupMay 1, 2014
  23. 7/8 CodingGuidelines: on comparisonJunio C Hamano, Apr 30, 2014
  24. Jeff KingMay 1, 2014
  25. Junio C HamanoMay 2, 2014
  26. Jeff KingMay 2, 2014
  27. Junio C HamanoMay 2, 2014
  28. 8/8 CodingGuidelines: once it is in, it is not worth the code churnJunio C Hamano, Apr 30, 2014
  29. 9/8 CodingGuidelines: on splitting a long lineJunio C Hamano, May 2, 2014
  30. brian m. carlsonMay 2, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.