On Tue, 3 Sep 2019 13:12:25 -0700, Vito Caputo <vcap...@pengaru.com> wrote:

> 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.

There's no unique "current directory", it's per-process, so even if mkdir
changed into the newly-created directoy, the caller (ie, the calling shell)
would be unaffected.
On the other hand, you can easily write a function to perform the two
actions, for example:

  mkdir -p -- "$1" && cd -- "$1"


Reply via email to