On 9/3/19 3:12 PM, Vito Caputo wrote:
> Hello list,
> Lately I've been finding myself wishing there were a flag for mkdir to
> cd into the directory, especially in combination with creating parents.
> It's like I'm already thinking in convenient shortcut mode asking for
> parents to be created and just want to throw another flag in there to
> switch my directory as well in the same command.
> i.e.
> short: mkdir -pc /foo
> long: mkdir --parents --chdir /foo
> Any chance of getting this in or too creepy?

It can't happen in coreutils.  The current working directory of the
shell CANNOT be influenced by the actions of a child process, which
coreutils would necessarily be.

It can, however, be done in the shell, if your shell author is
interested in writing a builtin version of mkdir (to match the fact that
chdir is already a shell builtin, for what should be obvious reasons).
However, you don't even have to modify the shell source code, but
instead just write a function to do the two steps in one function call.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to