Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: why is the - modifier useful



Op 01-07-2025 om 10:52 schreef Peter Stephenson:
On 01/07/2025 09:26 BST Marc Chantreux <mc@xxxxxxxxxx> wrote:
then I realize this custom came for reason: - is already a
builtin which seems really useless to me:

It's not very useful.  The convention used to be any command starting
with a "-" was a login shell, so you could start up your own command and
anything that cared would notice.  I'm not aware of anything that still
cares.

All the POSIXy shells care to this day, zsh included. So does tcsh.

E.g., the zsh command

  - bash

starts bash as a login shell by prepending a - to $0. This makes bash execute different profile scripts and makes the 'logout' command available.

--
||	modernish -- harness the shell
||	https://github.com/modernish/modernish
||
||	KornShell lives!
||	https://github.com/ksh93/ksh




Messages sorted by: Reverse Date, Date, Thread, Author