mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2002 (markdown)
@@ -4,13 +4,14 @@
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
cat file | tr ' ' _ | grep a_
|
cat file | tr ' ' _ | grep a_
|
||||||
|
cat file | ( while read i; do echo "${i%?}"; done )
|
||||||
```
|
```
|
||||||
|
|
||||||
### Correct code:
|
### Correct code:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
tr ' ' _ < file | grep a_
|
|
||||||
< file tr ' ' _ | grep a_ # **simple commands only, won't work with compounds
|
< file tr ' ' _ | grep a_ # **simple commands only, won't work with compounds
|
||||||
|
( while read i; do echo "${i%?}"; done ) < file # postfix works for everything
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
Reference in New Issue
Block a user