Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Any neat trick to convert print -rl -- **/** into a tree?
- X-seq: zsh-users 21942
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Any neat trick to convert print -rl -- **/** into a tree?
- Date: Sun, 18 Sep 2016 07:18:45 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0gOx4slRAZbjH2ZyAOVRW685beaYkgO5zICaGLYpeZI=; b=GwXLL2xlAGVJlR6VSJ+my84bGrI+I0HaOjwpFWXagdfPtegVZtIIAHi6vrV9/Gyupm V7FziJauDgPh3QKK2PxJ+HL1BGuxmdb7CaTLKSKwtSNIjsvtjOF7OFzkkgB+7cK/jg9Y OFekj1KpPT2uJ+pMCcEZS+HGN9nnzAoUYvcmpsMZzlOSm22srFYoj6SruchFfY4yHUT5 JhjY+kPhouGOu30pAcXtfW2RJIOwYuPS7+h882uxefgJhjqZ6oYsakAOAbqx5yPfY9hi +1KNKb30BhHPDfi15kOhUeqX4L6zxeUfWmW5juz/hhWCni/zG435Do8fztq4ZhoIB3u0 BCVg==
- In-reply-to: <160917155140.ZM30382@torch.brasslantern.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: <CAKc7PVDwSyb7G+QeO4crnkCrhAsTLd5iUfzCiVSfES0xy9Uzjw@mail.gmail.com> <160917155140.ZM30382@torch.brasslantern.com>
On 18 September 2016 at 00:51, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Sep 17, 5:54pm, Sebastian Gniazdowski wrote:
> } Subject: Any neat trick to convert print -rl -- **/** into a tree?
> }
> } Hello,
> } I'm blank at this but seeing wc -c > 60 various surprising Zsh
> } expansions I suspect that it can be done: converting **/**
>
> Do you intend that second ** to be interpreted GLOB_STAR_SHORT, or
> is that a typo?
*/** didn't have expected effect so I went to **/**, didn't thought
about **/* :|
> } into a tree, i.e. into output that looks like e.g. output of tree
> } command
>
> It's difficult if not impossible to do this *during* the glob pass,
> because the sorting ends up confused, but if you capture the result
> in a variable:
>
> () {
> emulate -L zsh -o extendedglob
> local x=(**/*)
> print -l ${x//([^\/]##\/)/|- }
> }
>
> Refine the replacement as desired.
Thanks!
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author