|
From: | Paul Eggert |
Subject: | bug#54174: (MacOS Monterey 12.2.1: zsh): grep "string" * is interpreted as grep -V when directory has a filename "-Vfilename.ext" |
Date: | Sun, 27 Feb 2022 15:22:29 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 |
On 2/27/22 11:31, Marja Koivunen wrote:
Maybe what is possible is to add a line to manual that explains that certain filenames that are OK in modern OS might not work with grep. I have used “-" sometimes to keep certain file at the top of directory hierarchy. In this case I was organizing libraries and marked those that I was not using with “-“.
Although that practice is tempting, it is probably not a good idea on any platform where you might use shell commands. POSIX says portable file names can't begin with '-'.
There is a section of the grep manual that talks about this but perhaps it is not clear enough. I installed the attached patch to try to make it better.
0001-doc-more-on-leading.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |