help / color / mirror / code / Atom feed
From: Vincent Bernat <bernat@luffy.cx>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: andme <15991987063@163.com>,  zsh-users <zsh-users@zsh.org>
Subject: Re: How to use precommand modifiers `-` ?
Date: Thu, 13 May 2021 14:00:43 +0200	[thread overview]
Message-ID: <m3wns24zdg.fsf@luffy.cx> (raw)
In-Reply-To: <CAN=4vMpXh-9Ja9tGJ_T8pgoX7Ehxm5FjNcqJW2AXZ2kOgHaX6A@mail.gmail.com> (Roman Perepelitsa's message of "Thu, 13 May 2021 13:04:04 +0200")

 ❦ 13 mai 2021 13:04 +02, Roman Perepelitsa:

>> ```-
>> The command is executed with a ‘-’ prepended to its argv[0] string.
>> ```
>> As a non-native speaker of English, I'm confused about this.
>> Can anyone give me some examples?
> Here's an example:
>     % zsh -fc 'print -r -- $0'
>     zsh
>     % - zsh -fc 'print -r -- $0'
>     -zsh
> Here $0 gives us argv[0].

To complete your answer, this is used by shells to know if they should
use a login session or not. Some shells, including Zsh, can also take an
option for that (-l), but it's not an universal option, hence the use of
this convention: either the target understands it and it works as
expected or it does not and it is harmless. I don't think there is any
other purpose.
Habit is habit, and not to be flung out of the window by any man, but coaxed
down-stairs a step at a time.
		-- Mark Twain, "Pudd'nhead Wilson's Calendar

      reply	other threads:[~2021-05-13 12:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  9:48 andme
2021-05-13 11:04 ` Roman Perepelitsa
2021-05-13 12:00   ` Vincent Bernat [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3wns24zdg.fsf@luffy.cx \
    --to=bernat@luffy.cx \
    --cc=15991987063@163.com \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-users@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).