mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2012 (markdown)
@@ -5,6 +5,7 @@
|
|||||||
```sh
|
```sh
|
||||||
ls -l | grep " $USER " | grep '\.txt$'
|
ls -l | grep " $USER " | grep '\.txt$'
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
NUMGZ="$(ls -l *.gz | wc -l)"
|
NUMGZ="$(ls -l *.gz | wc -l)"
|
||||||
```
|
```
|
||||||
@@ -14,10 +15,12 @@ NUMGZ="$(ls -l *.gz | wc -l)"
|
|||||||
```sh
|
```sh
|
||||||
find ./*.txt -user "$USER" # Using the names of the files
|
find ./*.txt -user "$USER" # Using the names of the files
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
gz_files=(*.gz)
|
gz_files=(*.gz)
|
||||||
numgz=${#gz_files[@]} # Sometimes, you just need a count
|
numgz=${#gz_files[@]} # Sometimes, you just need a count
|
||||||
````
|
```
|
||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
`ls` is only intended for human consumption: it has a loose, non-standard format and may "clean up" filenames to make output easier to read.
|
`ls` is only intended for human consumption: it has a loose, non-standard format and may "clean up" filenames to make output easier to read.
|
||||||
|
Reference in New Issue
Block a user