3 ms·
for file in *; do { ... }; done is both much easier and much safer than piping the output of ls. It does the correct thing with filenames containing spaces or
by foobar__ 9y ago
for file in *; do { ... }; done
is both much easier and much safer than piping the output of ls.
It does the correct thing with filenames containing spaces or weird characters, and the intent is much more visible, so there is really no reason to use $(ls).
More details: http://mywiki.wooledge.org/ParsingLs http://mywiki.wooledge.org/ParsingLs