[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cd"": Shouldn't it fail?
From: |
Kerin Millar |
Subject: |
Re: cd"": Shouldn't it fail? |
Date: |
Sun, 28 Jan 2024 14:36:11 +0000 |
On Sun, 28 Jan 2024 04:30:48 +0100
jwo@jwo.cz wrote:
> My opinion on this is that the ``cd ""'' command should fail with an
> error in this case. The zsh is the only POSIX-compatible or
> POSIX-shell-like shell that was available on machines to which I have
> access that exhibits this behavior.
>
> I think that the empty argument can be relatively frequently caused by
> substitution with some undefined variable -- it's better to warn the
> user than to perform actions in the wrong directory.
>
> We risk that this will break some badly written scripts.
>
> I propose to make Bash report an error when the user attempts to cd into
> empty string, possibly with an shopt option that allows changing
> behaviour of the cd back to the current one -- silently ignoring the
> command.
>
> Jiri Wolker.
>
Related: https://austingroupbugs.net/view.php?id=1047
An associated issue is that there presently appears to be no way of suppressing
the processing of CDPATH in bash.
--
Kerin Millar
- cd"": Shouldn't it fail?, jwo, 2024/01/28
- Re: cd"": Shouldn't it fail?,
Kerin Millar <=
- Re: cd"": Shouldn't it fail?, Oğuz, 2024/01/28
- Re: cd"": Shouldn't it fail?, Kerin Millar, 2024/01/28
- Re: cd"": Shouldn't it fail?, Oğuz, 2024/01/28
- Re: cd"": Shouldn't it fail?, Chet Ramey, 2024/01/30
- Re: cd"": Shouldn't it fail?, Kerin Millar, 2024/01/30
- Re: cd"": Shouldn't it fail?, Chet Ramey, 2024/01/30
- Re: cd"": Shouldn't it fail?, Kerin Millar, 2024/01/30
- Re: cd"": Shouldn't it fail?, Chet Ramey, 2024/01/30
Re: cd"": Shouldn't it fail?, Chet Ramey, 2024/01/30