Skip to content

Commit 6a49909

Browse files
committed
CodingGuidelines: give an example for redirection
Signed-off-by: Junio C Hamano <[email protected]>
1 parent 79fc3ca commit 6a49909

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Documentation/CodingGuidelines

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ For shell scripts specifically (not exhaustive):
6161
redirection target in a variable (as shown above), our code does so
6262
because some versions of bash issue a warning without the quotes.
6363

64+
(incorrect)
65+
cat hello > world < universe
66+
echo hello >$world
67+
68+
(correct)
69+
cat hello >world <universe
70+
echo hello >"$world"
71+
6472
- We prefer $( ... ) for command substitution; unlike ``, it
6573
properly nests. It should have been the way Bourne spelled
6674
it from day one, but unfortunately isn't.

0 commit comments

Comments
 (0)