Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A minor syntax question
- X-seq: zsh-users 21624
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- Subject: Re: A minor syntax question
- Date: Tue, 07 Jun 2016 13:54:43 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1465300485; bh=gbDrmhT3WWkxqCRBj13jKoL1xauxX166psISSMnSwjs=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=g+Zncp+8E2ACVXE3lpx48FH/U7NmhdZ3FKFYQ4mTOrMbsPtPq64ntQhEQ/jBFHlolfoejm/v2rNdaqF3PpeU35VRBYReprdpUE1D9zC9KyqTuzx7W+MUvKuYAlrHxSvJP2azuWL/v0J+6Dv0ULPU0hglQJpRVXTVw9TnsEXQPKI2jpG9L4kIASxLX+QJ6kEdjKwpgDc7QIfRIiwsQIePaB69VzOdTCoexYlW2wG8lLPvbD0vC5YhCnTZ+4ryFKCyX/zfhGuvBvhX7nnCoo9dAbocKmBz/PTqMLf4vAblBvjkpe0WQ/VXP6mf3WEWaPcA+7ueB+0WtYopyVU0q8ulEw==
- In-reply-to: <CABZhJg8eEekK6hdrGY-2uTB9V6LF5JqkHPOpT6NXx=Gkeeb1HQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABZhJg8eEekK6hdrGY-2uTB9V6LF5JqkHPOpT6NXx=Gkeeb1HQ@mail.gmail.com>
Jesper Nygårds wrote:
> typearg="("${"$(print -- '-o -type '${^types:#-t})"#-o }")"
> away the leading '-o'. It works as intended, but I feel it is more
> complicated than required. In particular, I couldn't find a way to make the
> '${^...}' parameter expansion trigger without the embedded print statement.
Joining the array to form a string should avoid the need for a print,
allowing the #-o to apply to the string as a whole. E.g:
typearg=${${(j. .):-'-o -type '${^types:#-t}}#-o }
Shorter versions should be possible such as the following:
typearg="${${=types//-t/-o -type}[2,-1]}"
I'd be inclined to keep typearg as an array, however.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author