4 ms·
for i in *; do ...; done works even better as it can handle files with whitespace. I usually disable file globbing but enable it specifically for code li
by wahern 8y ago
for i in *; do
...;
done
works even better as it can handle files with whitespace. I usually disable file globbing but enable it specifically for code like this.
EDIT: Actually, one issue with the above is that if there aren't any matching files then you get a literal "*". But I'd rather deal with that then break when filenames have embedded whitespace.