Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [ -d (#i)Temp ]
- X-seq: zsh-users 30525
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: [ -d (#i)Temp ]
- Date: Fri, 10 Apr 2026 20:48:21 +0200
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dhANpEJoKHNR06aky3znW8cVKdT3MgFD0nHyRgFh6DQ=; fh=D6X9xIaVjTSxb6gwuCseglo0uxyISp24IsyxMp5sRU4=; b=hmAYuNS0Ei0mPes9EwU66jHWLg3IjJv5AIvX/ihseFUAmuDqzKbcqq0owRm1CCLowt 9H493DYukqd9MYbciDZXh61Etn0fhmXZ5GXc2UKz8i0bpcVsqMKm3QlyuvFg0FaG+n29 0Hz1aeTnB91Xm02jCKLqEr/ex2OrE56yKfFdP5NJFEKAIMM26TASKer4FBpSpFcEXLjG uhNk0tzxCVvVKtErVQa/8DVaAq+tNFTVqXIeK0nYmimXXv+MRe9wlmzFDyBpkjLbTcqu HTUun8TmZV9maSxRxb2KesL9y86yH7gLJuXtSYHpuFS8+KSMK9AIOb1l37L8j4vpS3mx xtiQ==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1775846914; cv=none; d=google.com; s=arc-20240605; b=VAqEf9KHP1sC5k9FP2PuZOXXPrVab6ZCLj6BNIG9FzWsg3QLeSnbV93rqxbhOlg/a5 hcfvrmg6I2Da1wYAwuJ1iO5F4iabo1kj1+CeXOlKRw5b0LaSeNWdUWGqTTlaM+2Ml74o 1TtjO07GGtFU9hBmvKzF3mPSnQH/a+XusnrFuD6qoGQuJOfyNBw+N8qHd5HlfAnF+NZ5 c+z/TJNQgX4YUEt1oOEZXShG0CRPXXEzYf5AP/DC7lY9lj+5xVEG7elH1tkA50KFiTA+ jTS+wOH6pyebshojrf8ImbojvNRwoc5YsZvnk9LzoaExJgBF5cT6S+n7AxV3R/ZXc08u o+mg==
- Archived-at: <https://zsh.org/users/30525>
- In-reply-to: <bef4405f-072c-44f9-8544-e2b417bbff5f@eastlink.ca>
- List-id: <zsh-users.zsh.org>
- References: <dcc675da-fa5b-422c-bd63-748886ff1858@eastlink.ca> <1b9ee4e6-26a0-3393-be84-1031794fad1b@sonic.net> <bef4405f-072c-44f9-8544-e2b417bbff5f@eastlink.ca>
On Fri, Apr 10, 2026 at 8:36 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> 2 /aWorking/Zsh/Source/Wk 3 % md temp # in addition to /Temp
>
> 2 /aWorking/Zsh/Source/Wk 3 % [[ -d ''(#i)Temp(#qN) ]] && echo "it's a
> directory"
>
> 2 /aWorking/Zsh/Source/Wk 3 % rm -r temp
>
> 2 /aWorking/Zsh/Source/Wk 3 % [[ -d ''(#i)Temp(#qN) ]] && echo "it's a
> directory"
> it's a directory
>
> ... seems to fail with more than one match, exactly as desired. Seems
> perfect unless there' some gotcha.
It's checking for a directory named "Temp temp", which does not exist,
so you are getting the result you want by accident.
The simplest way I know of to achieve what you want:
local d=( (#i)Temp(/N) )
[[ ${#d} == 1 ]] && echo "there is exactly one (#i)Temp directory"
Note that this test succeeds if there is a directory named "temp" and
a regular file named "Temp". I presume that's what you want.
Roman
Messages sorted by:
Reverse Date,
Date,
Thread,
Author