1 day ago · Tech · hide · 0 comments

By default, Zsh globs are case-sensitive, so *.jpg matches beach.jpg but not CAT.JPG or dog.Jpg: $ ls photos/*.jpg photos/beach.jpg This is true even on macOS, where the filesystem is case-insensitive by default. Zsh shares this behaviour with Bash, but provides per-glob and global controls to make your globs case-insensitive and match all the files you probably meant. Per-glob with (#i) To make a single glob case-insensitive, use the (#i) glob flag, which makes the rest of the pattern case-insensitive: $ ls photos/*.(#i)jpg photos/CAT.JPG photos/beach.jpg photos/dog.Jpg Glob flags require the extended_glob option, which you can enable in your ~/.zshrc: setopt extended_glob Without it, Zsh treats (#i) as part of the pattern, leading to a confusing “no matches found” error. Flag placement (#i) applies from where it appears until the end of the pattern, including across directory separators. So you can put it at the start to make the whole pattern case-insensitive. For example, to find…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.