Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Printing arrays for use with $()
- X-seq: zsh-users 9298
- From: DervishD <zsh@xxxxxxxxxxxx>
- To: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>
- Subject: Re: Printing arrays for use with $()
- Date: Thu, 11 Aug 2005 22:09:13 +0200
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- In-reply-to: <20050811194046.GB49463@xxxxxxxxxxxxxxxx>
- Mail-followup-to: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: DervishD
- References: <20050811161654.GA8200@DervishD> <20050811194046.GB49463@xxxxxxxxxxxxxxxx>
Hi Dan :)
* Dan Nelson <dnelson@xxxxxxxxxxxxxxx> dixit:
> Why not use ${(q)array}? You probably also want to use print -r,
> othersize it will try and parse \-escape codes.
>
> dan% a=("file name" single\'quote double\"quote)
> dan% echo ${(q)a}
> file\ name single\'quote double\"quote
> dan% echo ${(qq)a}
> 'file name' 'single'\''quote' 'double"quote'
> dan% echo ${(qqq)a}
> "file name" "single'quote" "double\"quote"
> dan% print -l -- ${(qq)a}
> 'file name'
> 'single'''quote'
> 'double"quote'
> dan% print -rl -- ${(qq)a}
> 'file name'
> 'single'\''quote'
> 'double"quote'
Try, with your example, this:
du $(print -lr -- ${(q)a})
or any other of the examples ;) They will fail with exactly the
same problem I'm currently having. The problem is that the "print"
command doesn't quote properly its output (obviously, it has to
*print* it, not quote it to make it munchable for other commands).
Thanks anyway :)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
Messages sorted by:
Reverse Date,
Date,
Thread,
Author