Adding page since it wasn't there when I first encountered it.

cstackpole
2014-07-19 10:22:47 -07:00
parent 13963eaf9e
commit 57297ddfdc

17
SC2116.md Normal file

@@ -0,0 +1,17 @@
## SC2116 Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
### Problematic code:
a=$(echo $?)
### Correct code:
a="$?"
### Rationale:
Most of the time, this is an useless echo meaning it isn't doing anything that the Shell can't already do. Having the shell expand the contents for you is simpler and more reliable. Just remember to double quote the argument!
### Contraindications
None I am aware of at the moment.