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

Re: BUG? - 4.0.2 - parameter substitution won't double backslashes in values



On Thu, Feb 07, 2002 at 10:33:55AM +0000, Peter Stephenson wrote:
> Derek Peschel wrote:

> > I want to write the elements of $dirstack out to a file, separated by
> > newlines.  If an element in $dirstack contains a newline, I want to write
> > a backslash before the newline in the file.  Parameter substitution
> > managed that:
> > 
> > print ${dirstack[0]/
> > /\\\\
> > }
> >...
> 
> I haven't looked at this in detail, but you might be coming a bit unstuck
> by using `print' instead of `print -r'.  The latter will avoid interpreting
> the backslashes at that point, which is almost certainly closer to what you
> want.

Good advice.  I did have to read the sentence a couple of times to be
absolutely sure you were telling me to use "print -r".

But I would still expect some change (a backspace should change to "\b" when
using "print", or "\b" should change to "\\b" when using "print -r").
And there is absolutely none as far as I can tell.  And I think that's odd.

-- Derek



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