I came across this precommand modifier in man zshbuiltins which refers to man zshmisc.
I tried searching for examples, but didn't find any.
Here's what my man zshmisc page shows:
PRECOMMAND MODIFIERS
A simple command may be preceded by a precommand modifier, which will alter
how the command is interpreted. These modifiers are shell builtin commands
with the exception of nocorrect which is a reserved word.
- The command is executed with a `-' prepended to its argv[0] string.
Here's what I tried:
prompt> - echo
cd: no such file or directory: /Users/bmiller286/Projects/bgovecholonestar-eventsvc
What's an example or two of how to use this precommand modifier?
EDIT:
It looks like oh-my-zsh aliased - to be cd -, which explains why cd was complaining.
So far, I've only seen one use case that supports this paradigm of prepending an - to argv[0]--and that's login shells.
The documentation (above) acts like this is a common paradigm not specific to login shells. So,
- Is this basically a login-shell only thing?
- If not, is this a common easter egg that many programs support?
- If I were wanting to do an internet search for programs that support it, what would I search for? (it's hard to search for
-because many engines see it as a negative operator. Even searching for precommand modifiers turned up pretty much nothing for this thing)