Updated SC2202 (markdown)

Eisuke Kawashima
2025-07-29 10:53:34 +09:00
parent d1af1c13d0
commit 1f40b5b066

@@ -4,7 +4,6 @@
```sh
[ current.log -nt backup/*.log ] && echo "This is the latest file"
```
### Correct code:
@@ -30,7 +29,7 @@ Instead, use a `for` loop to iterate over matching filenames, and apply your con
If you know your glob will only ever match one file, you can check this explicitly and use the first file:
```
```sh
set -- backup/*.log
[ $# -eq 1 ] || { echo "There are too many matches."; exit 1; }
[ file.log -nt "$1" ] && echo "This is the latest file"