On Sun, Jul 13, 2025, at 4:53 PM, jason stein wrote:
> It's a history of all the paths we used with cd command, so it might be
> confusing due to legacy use of history, but it is a type of history.
Sure, in an abstract sense. However, in practice bash extensively
refers to the command history as "history", without qualification:
- The "history" command itself.
- The HIST* and histchars variables.
- The name of "history expansion".
- The history-* Readline variables.
- The *history* Readline commands.
- The "set -o history" option.
- The *hist* shopts.
In contrast, the documentation for dirs/popd/pushd is careful to
use distinct terminology (i.e., the "directory stack").
> I wanted something as short as possible (dirs is relatively long to
> type).
I know this is mostly a matter of personal preference, but I do not
find the argument "four characters is too long" all that compelling.
Keep in mind that the shorter the name of a new built-in, the more
likely it will interfere with some users' existing custom utilities.
> In addition, I wouldn't want to piggyback on a command that has
> a different functionality and is more for scripting.
My viewpoint is exactly the opposite: dirs, popd, and pushd are
clearly for interactive use and have limited utility for scripting,
where one can use subshells (or the end of the script) to switch
directories far more robustly.
> dh command is targeted towards a task all users do a lot.
I have no doubt that users tend to use a relatively small set of
directories. I'm not convinced that "write to disk on every single
directory change and implement a new command" is the best way to
help them achieve quick access.
> I would argue that cd is probably the most used builtin, so
> I don't see a problem providing a command that makes changing
> directories easier.
The question is not whether someone, somewhere, would find it useful;
it is whether this is something that is worth integrating directly
into the shell. I don't buy it, for whatever little that's worth.
Plus, I don't care for the idea of introducing a fourth (!!!) command
for changing directories.
--
vq