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

Re: auto-quoting inside braces in arguments



Bart Schaefer wrote on Thu, 18 Feb 2021 19:07 +00:00:
> Stop "eval"-ing things and you'll stop having problems.

+1.  You might still run into null elision, though.

> If for some reason "eval" is absolutely necessary, THEN you need to
> assess what quoting interpretation you WOULD have used if the
> argument(s) to eval were the original command line, and re-apply those
> quotes, which zsh makes possible with ${(q)...} or ${(qqq)...} or
> whatever.

Hang on.  Why would it matter which style of quotes would have been
used?  Considering «eval "$foo${(q)bar}$baz"», normally $foo would be
constructed to end on inter-token whitespace, and then the number of q's
wouldn't matter, whether it's 1, 2, 3, 4, q+, or q-.




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