4 ms·
Another approach is adding filenames after a "--" terminating option. Most, though not all, commands support it, like: ls -l -- -file-name-with-dash cat
by tyingq 3y ago
Another approach is adding filenames after a "--" terminating option. Most, though not all, commands support it, like:
ls -l -- -file-name-with-dash
cat -- -file-name-with-dash
- Anthony-G 3y agoThis is discussed in the featured article: https://dwheeler.com/essays/filenames-in-shell.html#dashdash https://dwheeler.com/essays/filenames-in-shell.html#dashdash As you point out, not all commands support this convention and the author feels that it would be hard to enforce this consistently among maintainers. I agree that it would be easier (for me) to remember to prefix globs with `./`.
- tyingq 3y agoI'd argue it's not quite as terrible as the author suggests. Getopt(3), for example, uses it, so many programs pick it up from there. As do many popular getopt() variations for other languages...Golang's "flag" built-in, for example. So it's not universal, but it's also more common than you might imagine.