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

Re: quote modifier for parameter expansion?



On Feb 3,  5:02pm, Peter Stephenson wrote:
} Subject: Re: quote modifier for parameter expansion?
}
} Sven Wischnowsky wrote:
} > Hm. I'm sure I'm missing something again, but could anyone please tell 
} > me what? The patch below (which probably shouldn't be used) just uses
} > the quote()-function from hist.c to make the `q' modifier in parameter 
} > expansion work.
} 
} % bar="hello'there"
} % print -r $bar:q
} 'hello'\''there'
} 
} Maybe the point is simply it's got limited application, since unless
} it's going into an eval the extra quotes aren't all that useful,

Maybe the point is that :q is a csh-ism, and that result is nothing like
what csh would produce.

In the old days before people worried about 8-bit characters, :q in csh
simply set the high-order bit of every character in the variable value.
Then those high bits would get stripped off again after all the other
substitutions were applied.  Thus there was no user-visible change to
the string.

That doesn't make it useless, but if we keep it, it belongs in the
section on differences from (t)csh.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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