This looks like a bug in Bash: per
man builtins the old behaviour is the correct one.
cd [-L|[-P [-e]] [-@]] [dir]
Change the current directory to dir. if dir is not supplied,
the value of the HOME shell variable is the default. Any
additional arguments following dir are ignored.
You can report the bug on the
bug-bash mailing list; more details here.
Actually, the bug was reported (long ago). If you want a fixed Bash now, now, now, here's how to do it properly (tested on 17.10, should work on others as well).
First create a directory to work in, for example:
Get the source package and the build dependencies:
apt-get source bash
sudo apt-get build-dep bash
config-top.h to change this (should be line 32)
/* #define CD_COMPLAINS */
debian/changelog and add an entry like this at the top (you can also use the command
bash (4.4-5ubuntu1+cd) artful; urgency=medium
* Fix cd.
-- Firas Kraiem <firstname.lastname@example.org> Thu, 04 Jan 2018 21:11:22 +0900
The most important points are to append
+foo to the current version number (
foo can be any string of lowercase letters; and be careful if you use
dch -i, it will increment the last number, so you need to revert it to the current one) and to use the correct release name (
artful here). Finally, run
You can then run the
debuild command, and if everything goes well (errors about
debsign can be ignored) you should have some
.debs in the parent directory, which you can install as usual (there is no need to install all of them, just the ones you have now; use
dpkg -l | grep bash to find out).
Note that the version number of the new package is set so that you will automatically get any future update to
bash; if the update does not fix the problem, you have to repeat the above process.
(This answer was first posted on this duplicate question.)
cdtwo locations, and somehow expect it to figure out which one you want.