Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: command cd doesn't work on some builds of zsh
> On 13/02/2024 09:54 GMT Ajeet D'Souza <98ajeet@xxxxxxxxx> wrote:
>
>
> Hi, I found inconsistent behaviour of the command builtin in some builds on zsh.
>
> On Fedora 39:
> $ zsh --version
> zsh 5.9 (x86_64-redhat-linux-gnu)
> $ zsh -c 'command cd'
>
> On Debian 10:
> $ zsh --version
> zsh 5.9 (x86_64-unknown-linux-gnu)
> $ zsh -c 'command cd'
> zsh:1: command not found: cd
>
> According to the manual, command cd should work:
> > Run command with args suppressing the normal shell function lookup. Only builtin commands or commands found in the PATH are executed.
>
> Any idea why different builds on zsh produce different outcomes here?
It's likely to be a difference in the setting of the POSIX_BUILTINS
option between the two cases. By default, with it off, "command"
doesn't apply to builtins --- you'd need to use "builtin cd" in
vanilla zsh to ensure it was running the builtin command.
With POSIX_BUILTINS set it'll find cd.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author