Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: protect spaces and/or globs



> On Feb 9, 2021, at 9:25 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> 
> On 2021-02-09 5:46 p.m., Lawrence Velázquez wrote:
> 
>> ... which youhave already decided is an ulcer and cannot possibly be anything
>> other than an ulcer.
> It would take far too long to explain the whole show.  If you have the time and interest
> contact me privately and I'll show you what I'm up to.  But I already waste far too much
> of the list's time.

Au contraire.

https://www.mikeash.com/getting_answers.html#provide

>> % () { eval "print -rC1 -- ${(q)@}" } a 'b c' d 'e f g'
>> 	a
>> 	b c
>> 	d
>> 	e f g
>> 
>> 
> Thing is that if those args were going to grep and they were filenames you'd end up with:
> 
> $ grep [some search string] a b c d e f g

No. This has nothing to do with grep and everything to do with how
you assemble the eval argument.

% () { emulate -L zsh && eval "grep ${(q)@}" } pattern 'file 1' file2 'file the third'
grep: file 1: No such file or directory
grep: file2: No such file or directory
grep: file the third: No such file or directory

--
vq



Messages sorted by: Reverse Date, Date, Thread, Author