#653311 Suggestion: mkcdir

Package:
moreutils
Source:
moreutils
Description:
additional Unix utilities
Submitter:
Björn Persson
Date:
2011-12-26 23:15:03 UTC
Severity:
wishlist
#653311#5
Date:
2011-12-26 18:20:17 UTC
From:
To:
I have often wanted a command combining mkdir and cd. I looked around and
found several blog and forum posts showing quick and dirty implementations,
but none that were complete enough to include in a distribution, so I wrote
this one.

Do you think this would fit in the Moreutils collection? It is admittedly
somewhat different from most of the other tools in that it can't be used in
a pipeline.

I was originally going to call it "mkcd", but that's apparently a CD making
program in Solaris and Mandriva. "mcd" is taken by Mtools, to I decided on
"mkcdir".

The command is implemented as a shell function, as a child process can't
change the working directory of its parent. I don't expect it to work in a
plain Bourne shell, but I have tested it in Bash, Kornshell and the Z Shell.
I don't have an implementation for the C Shell. That would have to be quite
different.

#653311#10
Date:
2011-12-26 18:59:28 UTC
From:
To:
Björn Persson wrote:

I don't think it really fits, since this kind of thing requires shell
setup, and moreutils is about simple commands that just work.

#653311#15
Date:
2011-12-26 22:34:43 UTC
From:
To:
Joey Hess wrote:

It doesn't require any setup in Fedora at least. A Fedora package would simply
install the file as /etc/profile.d/mkcdir.sh. It would only be available in
shells started after the package was installed, but other than that it would
just work. If other distributions don't have /etc/profile.d and don't allow
packages to edit /etc/profile automatically, then I guess some manual
configuration will be necessary.

(In case you're wondering: I submitted this to the Debian bug tracker because
I got the impression that Moreutils uses the Debian bug tracker instead of
having its own, not because I'm primarily a Debian user.)

Oh well, if you don't want it I'll find some other way of distributing it.

Björn Persson