On 07/28/2011 06:52 PM, Willian Sodré da Paixão wrote:
Almost every time I make a directory, I get into it.
So, I thought: would be nice if a parameter -something create and enter the
new directory.

Thanks for the idea, but we _can't_ implement it in coreutils. The notion of the current working directory is per-process - if you spawn a new mkdir child process, then there is no way that the child can cause the parent to chdir().

Rather, _you_ must implement this as a shell function or alias in your shell. Something like this (untested) would call mkdir with all arguments, and if that succeeds, then change directory to the last argument:

mkdir_cd () {
  mkdir "$@" && eval cd "\"\${$#}\""
}

--
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Reply via email to