Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • I had a feeling zsh would have some clever magic to handle this. I didn't know about the e-qualifier and it seems quite powerful. Here's my modified version: ^*.(signed|jnl|jbk)(e:'[[ ! -f "$REPLY.signed" ]]':). Commented Dec 11, 2017 at 14:10
  • @Joe. That works too. [[ -e file ]] is for whether the file exists. -f adds the additional requirement that it be a regular file (and not other types of files like directory, socket, fifo, device...). If you only want to consider regular files, you could add the . glob qualifier (or -. to allow symlinks to regular files). Commented Dec 11, 2017 at 14:17
  • Oh right i didn't realize you can negate any qualifier with ^. That's handy! I think now it's the time to add extendedglob to my .zshrc. Commented Dec 12, 2017 at 6:19
  • @Joe, note that ^ to negate qualifiers doesn't require extendedglob, it's the ^ glob operator that does. Still extendedglob is useful for a variety of operators like # (equivalent of RE *), ## (RE +), (#i) (case insensitive), (#c3,9) (RE {3,9}), ^ (not), ~ (except), and some used primarily in pattern matching more than globs. Commented Dec 12, 2017 at 8:28