Reputation: 91
So in zsh; do this
$ - ls /some/non/existent/directory/blah/blah/blah
gives you
-ls: /some/non/existent/directory/blah/blah/blah: No such file or directory
Documentation:
http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Precommand-Modifiers
What reasonable use case does this actualy have?
Upvotes: 4
Views: 446
Reputation: 530922
From zshmisc(1)
:
- The command is executed with a `-' prepended to its argv[0]
string.
Invoking a shell with a -
prepended to its name (-sh
, -bash
, -zsh
) is an old convention for indicating the shell should start a login session. It's up to the program itself to decide if such an invocation should mean anything. Most programs, like ls
, ignore how they are called.
Upvotes: 3