On 2/28/22 06:01, Marja Koivunen wrote: > Ok. I understand it is not possible to make “-V “ instead of “-Vfilename” > because so many existing scripts rely on thatgrept works a certain way. > > Maybe there is a way to add space after “-V “ and possibly also other options > that could be used as part of a filename in some operating systems?
G'day again Marja, [The following message is Bourne shell-specific; I haven't researched exactly how this relates to zsh (especially the environment variable IFS.] -- David Wheeler's essay suggests modifying IFS (input field separator) to exclude spaces, as these occasionally appear in filenames: The default in the shell is: IFS="$(printf ' \n\t')" # space, newline and TAB David suggests eliminating the space as a separator, as it causes more trouble than its worth in some situations: IFS="$(printf '\n\t')" Going past David's suggestion, I've found that, occasionally, usually during debug output, I want TAB-separated words, not Newline-separated words. This leads to a further, optional tweak: IFS="$(printf '\t\n\t')" Note that, in all of this, there is a very subtle dance going on between two different entities: The Grep program, and the (Bourne?) Shell. You need to understand what the shell is doing, before looking at Grep's (or ant other's) dealing with the modified command line. An example of how subtle/difficult the interaction can be is that the version control program Git, originally implemented as shell scripts, was re-implemented in C, at least partially because of these sorts of interactions. -- [An advert for my "PosixExec.lua" add-on to "luaposix" rock deleted.] -- Hope this helps, s-b etc etc