diff --git a/SC2144.md b/SC2144.md index 17f3217..10eadca 100644 --- a/SC2144.md +++ b/SC2144.md @@ -45,15 +45,13 @@ for f in /path/to/your/files*; do done ``` - - ### 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. You may still want to consider making this assumption explicit and failing fast if it's ever violated: -``` +```bash files=( dir/file* ) [ "${#files[@]}" -ge 2 ] && exit 1 if [ -e "${files[0]}" ]