zsh-users
 help / color / mirror / code / Atom feed
* builtin log supercedes "log" command, only in non-interactive mode
@ 2021-11-11  6:03 Zach Riggle
  2021-11-11  6:24 ` Lawrence Velázquez
  0 siblings, 1 reply; 3+ messages in thread
From: Zach Riggle @ 2021-11-11  6:03 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

So it seems that "builtin log" takes precedence over commands named "log"
in $path, but only for non-interactive shells.

Is this intentional?  It seems unexpected to me, and it was quite hard to
figure out what the root cause was as the error message is not useful
(./myscript:log:5: too many arguments).

I know I can work around this with "command log", I was just surprised that
it works this way.

    $ cat what
    #!/usr/bin/env zsh
    which -a log

    $ which -a log
    /usr/bin/log

    $ zsh ./what
    log: shell built-in command
    /usr/bin/log

    $ zsh -i ./what
    /usr/bin/log

*Zach Riggle*

[-- Attachment #2: Type: text/html, Size: 982 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: builtin log supercedes "log" command, only in non-interactive mode
  2021-11-11  6:03 builtin log supercedes "log" command, only in non-interactive mode Zach Riggle
@ 2021-11-11  6:24 ` Lawrence Velázquez
  2021-11-11  6:40   ` Lawrence Velázquez
  0 siblings, 1 reply; 3+ messages in thread
From: Lawrence Velázquez @ 2021-11-11  6:24 UTC (permalink / raw)
  To: Zach Riggle; +Cc: zsh-users

On Thu, Nov 11, 2021, at 1:03 AM, Zach Riggle wrote:
> So it seems that "builtin log" takes precedence over commands named 
> "log" in $path, but only for non-interactive shells.

I'm going to guess that you're on macOS, which ships with an
/etc/zshrc that runs `disable log`.

If not, check your system's startup files anyway.

> I know I can work around this with "command log", I was just surprised 
> that it works this way.

It doesn't.

-- 
vq


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: builtin log supercedes "log" command, only in non-interactive mode
  2021-11-11  6:24 ` Lawrence Velázquez
@ 2021-11-11  6:40   ` Lawrence Velázquez
  0 siblings, 0 replies; 3+ messages in thread
From: Lawrence Velázquez @ 2021-11-11  6:40 UTC (permalink / raw)
  To: Zach Riggle; +Cc: zsh-users

On Thu, Nov 11, 2021, at 1:24 AM, Lawrence Velázquez wrote:
> On Thu, Nov 11, 2021, at 1:03 AM, Zach Riggle wrote:
>> I know I can work around this with "command log", I was just surprised 
>> that it works this way.
>
> It doesn't.

To clarify, I mean that the distinction you've described is not
inherent to the shell.  Enabled builtins always take precedence
over $path executables.  (See zshmisc(1), "COMMAND EXECUTION".)

-- 
vq


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-11  6:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11  6:03 builtin log supercedes "log" command, only in non-interactive mode Zach Riggle
2021-11-11  6:24 ` Lawrence Velázquez
2021-11-11  6:40   ` Lawrence Velázquez

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).