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

Re: [bug] backslash stripped in sh/ksh emulation



On Tue, Oct 11, 2005 at 12:36:24PM +0100, Peter Stephenson wrote:
> Stephane Chazelas <Stephane_Chazelas@xxxxxxxx> wrote:
> > $ ARGV0=ksh zsh -xc 'a="\\*"; case $a in *\\*) echo a;; esac'
> > + a='\*'
> > + case * (*\*)
> > 
> > Can anyone explain it? It's OK if $a is quoted as in <case "$a">
> > 
> > After investigation, it appears it is triggered by globsubst.
> 
> You're basically pointing out that in:
> 
> a='\\*'
> print -r ${~a}
> 
> the output is
> 
> \*
[...]

Not really. I could be fine with that (though other shells
behave differently) as leaving a variable unquoted in list
context (as in arguments to a command above) is known not to be
reliable anyway.

My concern was more in non-list contexts.

In

emulate sh
var='\\'
newvar=$var

I expect newvar to be the exact copy of var.

-- 
Stéphane



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