Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [ -d (#i)Temp ]



@Perry Smith:

Nope, it's all about the case insensitivity.


On 2026-04-10 10:53, S. Cowles wrote:

one solution: (note corrected name)

[[ -d ${:-"$( echo (#i)Temp )"} ]] && echo "it's a directory" || echo no such dir

Mirabile dictu, it works!  Pretty byzantine tho, I wonder if there's an easier way.  Still I'll take it, thanks.  I understand the code except for the ':-', what does that do?  Oh, right about the double brackets, I keep forgetting that.

Roman:

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.





Messages sorted by: Reverse Date, Date, Thread, Author