Re: [ -d (#i)Temp ]

Roman Perepelitsa <[email protected]> Fri, 10 Apr 2026 21:42:44 +0200
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAN=4vMrhVkk_Ntdz7HAS53su-6T_tOBF38fawegd7LRm-4t_5w@mail.gmail.com>
On Fri, Apr 10, 2026 at 8:49 PM Bart Schaefer <[email protected]> wrote:
>
> A better construction might be to use the "test" builtin:
>
> test -d (#i)Temp && echo "it's a directory"

This does not work if nothing matches (#i)Temp, with and without nullglob.

% ls
% unsetopt nullglob
% test -d (#i)Temp && echo "it's a directory"
zsh: no matches found: (#i)Temp
% setopt nullglob
% test -d (#i)Temp && echo "it's a directory"
it's a directory

Roman