On 2017-03-18 17:07, David Haller wrote:
Hello,
On Sat, 18 Mar 2017, Carlos E. R. wrote:
On 2017-03-17 08:34, Andreas Mahel wrote:
The issue in the systemd unit directory is different: in that folder exists a file named "-.slice".
And the file name starting with a dash will make grep interpret this as a set of command line options, where it fails at the first one already, the dot.
Grep could deduce that, as that "-.slice" is an apparent option in the middle of some files, that it is an error, and report it as such.
Albeit, yes, but that would be some heuristic doomed to fail in the most inconvenient way at some point... Better stay with what most other commands do and be consistent.
Consider:
$ grep bla foo*
you remember, fsck, I need just a fixed-string search
$ grep bla foo* -F
you remember you need to search bar* too
$ grep bla foo* -F bar*
But then, suppose: grep bla *foo -F bar* And there is one file in the directory named "-foo", you could have a problem.
With your proposition, this would not be possible. Yes, it's stupid. But not quite unrealistic, if your wrangling long cmd-lines and know the GNU toolchest / getopt.
My idea is to just take the chance to enlighten users when an error like that is detected. -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" (Minas Tirith))