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 21939
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Any neat trick to convert print -rl -- **/** into a tree?
- Date: Sat, 17 Sep 2016 15:51:40 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=NM1Sjs4QJSw7C+kOziM9yheX/NZdsCRQKbZ1/htXqOs=; b=rOfzK9cIVjm7UGm/AlnnyRit6g0bptOhuP/Kl0giWoeHmUcANBzMOanA5QNbEQrOLp mPdLDoDLruapIgY/a02phwgfpiY1Y0MjTnQQj2TcoiqZQF9Jd9BOp9wvtTGKHuCbfbmm /HKJ9KmZUPSGQmNuT1YkSj0b38NaCDY5lzhb6xbRhSjQe2KCWQPh4OQVJ6IziJy1xfGS umq0uYFEJKjmxYt9cwbSy4SzWmJ+yXrOrGTmO02V9nDhD45uVZ9r/2eilWNQXf4Mz3xq U1l4gCjbciyNRVf2fwsisc7KPvVSeBT3haOACCc2jA1zwdrsW2LMbQl2UycnSrmhrvI2 elcQ==
- In-reply-to: <CAKc7PVDwSyb7G+QeO4crnkCrhAsTLd5iUfzCiVSfES0xy9Uzjw@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: <CAKc7PVDwSyb7G+QeO4crnkCrhAsTLd5iUfzCiVSfES0xy9Uzjw@mail.gmail.com>
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?
} 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author