Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: extra arguments inserted by glob thinger e:: get sorted afterwards
- X-seq: zsh-workers 27690
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: extra arguments inserted by glob thinger e:: get sorted afterwards
- Date: Mon, 8 Feb 2010 18:16:39 +0100
- Cc: JÃrg Sommer <joerg@xxxxxxxxxxxx>, zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=PrIfmREiOjJuAzzSdBGatrFND6+BWeB8rifhFVb9pf0=; b=EGcJtdWmhuCu46fI5Qv5C8XsHHSucRRMiKwSa88ZCQ9upeO/8X/CQktozF5/Lxq7+E 0ABF7KRTqAvBgPmzko4COtqQZwkJWjgx2OI07loKtRcQsoZJECAzH2ii6F8XqVMTD3Fi GuCYVtEZrjLWNaayGfI9rEXSiHo7XkDRkjIno=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=tJK9Z9aU2hOdUR+mdALrd5jzjxIaxKsquUrLd+Wdefr2grfryfSsWGiA9NLezjN2L9 fwnHi3ZGa/17L0TkJ5dgK13r2Q5rEINRdk36n9pjL+q5SIAgsRz3Zu5BhyKo9EfEFMfk L4ipQdX9uIARV7ZTPWmjK9YYRsAG5hAIQHGK4=
- In-reply-to: <87ljf3yk0f.fsf@xxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <237967ef1002050715o3be2d441rcc8dbeb3e2b00483@xxxxxxxxxxxxxx> <slrnhmvok6.2k5.joerg@xxxxxxxxxxxx> <87ljf3yk0f.fsf@xxxxxxxxxxxxxxxxxxxxxx>
On 8 February 2010 13:44, Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
> JÃrg Sommer wrote:
> [...]
>>> % print -- *.sh(oNe:'reply=(-f $REPLY)':)
>>> -f zmpc.sh -f ifs.sh -f test.sh -f script_pandora.sh
>>
>> Why not use $^?
>>
>> % print -- -f\ ${(f)^"$(print -l /bin/ls*)"}
>> -f /bin/ls -f /bin/lsmod
>
> Because:
> % print -l -- -f\ ${(f)^"$(print -l /bin/ls*)"}
> -f /bin/ls
> -f /bin/lsmod
>
> "-f /bin/ls" would be one word to the shell.
And also because:
# touch /bin/ls'
fail'
% print -- -f\ ${(f)^"$(print -l /bin/ls*)"}
-f /bin/ls
-f /bin/ls
-f fail
-f /bin/lsmod
$() is almost impossible to get right wrt quoting.
print -l -- -f\ ${(0)^"$(printf '%s\0' /bin/ls*)"} probably works a
bit better, but of course it's still useless since the -f is not a
separate parameter.
As an aside, is "$(echo a b c)" the only way to get an 'inline' array
in a ${} expression? I sometimes want to use a glob qualifier on a
middle part of a path but then I need to use temp arrays (and I'd
rather not use $() there).
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author