Bash Command "mkcd"
Colin Watson
cjwatson at ubuntu.com
Thu Feb 24 10:30:46 UTC 2022
On Wed, Feb 23, 2022 at 02:39:28PM +0000, Pixelbog Pixi wrote:
> I have a question:
> Is it possible to add the command mkcd?
> It stands for make & change directory and I think it will be super usefull.
>
> It happened already way too often that I typed "mk foo && cd foo" and
> with mkcd it will save 8 keystrokes for the example "foo".
>
> I wrote a little script that gets every directory on my computer and found out that the average
> size of a directory 7.879865977982097 is. That means I would save on average 12-13 keystorkes
> for creating a dir and changing into it.
>
> Ofcourse I know you can write a function in .bashrc, but isn't it the same.
Any such command would have to be a shell builtin; "cd" can't be
implemented as a subprocess, because it needs to change a property (the
current working directory) of the shell process calling it. It's also
the sort of thing that would tend to attract requests for options, such
as "-p" passed through to "mkdir -p".
I'm not the bash maintainer, but the bar for new shell builtins is
rightly high since any additions would affect all systems, and I would
expect this to be refused since it's easy to implement it as a local
shell function with whatever behaviour and spelling you want.
--
Colin Watson (he/him) [cjwatson at ubuntu.com]
More information about the ubuntu-devel
mailing list