mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2144 (markdown)
@@ -45,15 +45,13 @@ for f in /path/to/your/files*; do
|
|||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Exceptions
|
### Exceptions
|
||||||
|
|
||||||
If you are sure there will only ever be exactly 0 or 1 matches -- and `nullglob` is not enabled -- then the test happens to work.
|
If you are sure there will only ever be exactly 0 or 1 matches -- and `nullglob` is not enabled -- then the test happens to work.
|
||||||
|
|
||||||
You may still want to consider making this assumption explicit and failing fast if it's ever violated:
|
You may still want to consider making this assumption explicit and failing fast if it's ever violated:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
files=( dir/file* )
|
files=( dir/file* )
|
||||||
[ "${#files[@]}" -ge 2 ] && exit 1
|
[ "${#files[@]}" -ge 2 ] && exit 1
|
||||||
if [ -e "${files[0]}" ]
|
if [ -e "${files[0]}" ]
|
||||||
|
Reference in New Issue
Block a user