3 ms·
There are several reasons. - Running ls forks an unnecessary process. - The ls may be aliased with "-F" (or -p) which will corrupt the filenames. - Environme
by chasil 3y ago
There are several reasons.
- Running ls forks an unnecessary process.
- The ls may be aliased with "-F" (or -p) which will corrupt the filenames.
- Environment variables may otherwise (unexpectedly) manipulate ls behavior.
- Files with spaces will not be evaluated correctly.
- Hostile files can be placed that mimic command line arguments.
The shell should evaluate filenames itself; it is very capable of doing so.
POSIX ls: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/l...