Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Silly question on :h and = expansion
On Tue, Aug 17, 2021 at 4:27 PM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
>
> Awesome!!! These are all wonderful. "=foo(:h)" is the most concise
> way I see, and fits with my style.
It might be worth noting: That formulation only works in contexts
where globbing is done, so not e.g. in conditionals.
% [[ -f =zsh ]] && echo yes
yes
% [[ -d =zsh(:h) ]] && echo yes || echo no
no
% [[ -d ${${:-=zsh}:h} ]] && echo yes || echo no
yes
Messages sorted by:
Reverse Date,
Date,
Thread,
Author