Created SC2129 (markdown)

koalaman
2014-04-19 11:59:43 -07:00
parent 3143e8d990
commit 38c0dccb21

24
SC2129.md Normal file

@@ -0,0 +1,24 @@
## Consider using { cmd1; cmd2; } >> file instead of individual redirects.
### Problematic code:
echo foo >> file
date >> file
cat stuff >> file
### Correct code:
{
echo foo
date
cat stuff
} >> file
### Rationale:
Rather than adding `>> something` after every single line, you can simply group the relevant commands and redirect the group.
### Contraindications
This is mainly a stylistic issue, and can freely be ignored.