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

Re: Quoting problems



On Tue, 16 Feb 2016 08:53:05 +0100
Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> Hello,
> # source test_script > a
> # source ./a
> ./a:156: unmatched "
> ./a:157: invalid function definition
> 
> 
> It's about following line:
> [[ $#exp -eq 1 && "${exp[1]//\}" = "${word//\}"(|\(N\)) ]]
> 
> The first and second backslash aren't quoted and cause the two '{' to
> be unbound.

Looking at your code, I think you'll find this is because you're using
echo without the option not to expand bacslashes.  Try "echo -E" or
"print -r".  (I'd recommend "print" if this is zsh-specific as echo
is mostly there for backward compatibility, although there's no reason
it shouldn't work here.)

pws



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