Zsh: select files with arbitrary code in (e) or + glob qualifiers 0 ▲ Adam Johnson 1 hour ago · Tech · hide · 0 comments Zsh glob qualifiers can select files by many built-in attributes: type, size, modification time, and more. But when no built-in qualifier fits, you can bring in the e or + qualifiers to run arbitrary code, making globs a fully programmable file filter. With great power comes great responsibility! The e syntax looks like this: extend your glob, like *, with (e:'CODE':), replacing CODE with your Zsh code to run. : is an arbitrary delimiter, and the quoting is needed to stop Zsh from expanding variables and interpreting special characters before the glob runs. Zsh runs the code once per matched file, with the file name in the $REPLY variable, and keeps the file if the code exits successfully (status 0). The + syntax is simpler, as it takes just a command name to run, which is most usefully a Zsh function, as seen below. Using e to check for .git I’ll show you with an example. Say I have a bunch of my open source repositories in a directory, along with some other stuff: $ print -l *… No comments yet. Log in to reply on the Fediverse. Comments will appear here.