[-- 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 --]
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
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