Hi all,
Please read:
- http://mywiki.wooledge.org/ParsingLs
- http://mywiki.wooledge.org/BashFAQ/003
There are a bunch of things wrong with parsing ls output and using
unquoted command substitutions and parameter expansions. It may be
right for your use case, but please still be aware of the
complications that may arise if the filenames are more complex.