4 ms·
Don't parse the output of ls, use globbing or find. Here are some examples https://mywiki.wooledge.org/ParsingLs https://mywiki.wooledge.org/ParsingLs
by g0xA52A2A 2y ago
Don't parse the output of ls, use globbing or find. Here are some examples https://mywiki.wooledge.org/ParsingLs https://mywiki.wooledge.org/ParsingLs
- kleiba 2y agoThe problem is existing shell scripts not written by yourself.
- nvllsvm 2y agoThis is why I encourage not overriding common commands in $PATH. Setup an alias instead so it only applies to interactive shells (or just type the new command :p). Shell scripting is already fickle enough with compatibility issues across the major implemtations of POSIX utils (GNU, macOS/ BSD, Busybox). Even /bin/sh itself cannot be relied upon to behave consistently across platforms. Notably, Busybox's ash supports the non-POSIX substring syntax that Bash does. This won't work on distro's like Debian where /bin/sh is linked to dash shell.