* How to use precommand modifiers `-` ?
@ 2021-05-13 9:48 andme
2021-05-13 11:04 ` Roman Perepelitsa
0 siblings, 1 reply; 3+ messages in thread
From: andme @ 2021-05-13 9:48 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1: Type: text/plain, Size: 189 bytes --]
```-
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?
Thanks
[-- Attachment #2: Type: text/html, Size: 1704 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to use precommand modifiers `-` ?
2021-05-13 9:48 How to use precommand modifiers `-` ? andme
@ 2021-05-13 11:04 ` Roman Perepelitsa
2021-05-13 12:00 ` Vincent Bernat
0 siblings, 1 reply; 3+ messages in thread
From: Roman Perepelitsa @ 2021-05-13 11:04 UTC (permalink / raw)
To: andme; +Cc: zsh-users
On Thu, May 13, 2021 at 12:56 PM andme <15991987063@163.com> wrote:
>
> ```-
>
> 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].
Roman.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to use precommand modifiers `-` ?
2021-05-13 11:04 ` Roman Perepelitsa
@ 2021-05-13 12:00 ` Vincent Bernat
0 siblings, 0 replies; 3+ messages in thread
From: Vincent Bernat @ 2021-05-13 12:00 UTC (permalink / raw)
To: Roman Perepelitsa; +Cc: andme, zsh-users
❦ 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-13 12:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 9:48 How to use precommand modifiers `-` ? andme
2021-05-13 11:04 ` Roman Perepelitsa
2021-05-13 12:00 ` Vincent Bernat
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).