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

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

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

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