From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5554 invoked from network); 7 Feb 2002 10:46:04 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 7 Feb 2002 10:46:04 -0000 Received: (qmail 6650 invoked by alias); 7 Feb 2002 10:45:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16585 Received: (qmail 6639 invoked from network); 7 Feb 2002 10:45:57 -0000 From: Sven Wischnowsky MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15458.23199.580619.840108@wischnow.berkom.de> Date: Thu, 7 Feb 2002 11:44:47 +0100 To: zsh-workers@sunsite.dk Subject: Re: BUG? - 4.0.2 - parameter substitution won't double backslashes in values In-Reply-To: <20020206203926.A10484@eskimo.eskimo.com> References: <20020206203926.A10484@eskimo.eskimo.com> X-Mailer: VM 6.95 under 21.5 (patch 3) "asparagus" XEmacs Lucid 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: If what you're really after is being able to dump the value of $dirstack to a file to be able to restore it from that file later, you could just use some trickery: dump_dirstack() { print -lr 'dirstack=(' "${(q@)dirstack}" ')' > ~/.dirstack } # pretty useless wrapper function... restore_dirstack() { . ~/.dirstack } Or some such. A generic function to store an array (1st arg) to a file (2nd arg) would be: dump_array() { print -lr "$1=(" "${(P@q)1}" ')' > $2 } Hope that helps... Bye Sven -- Sven Wischnowsky wischnow@berkom.de