On 23/03/10 15:43, Ben Walton wrote:
> Excerpts from Claes Lindvall's message of Tue Mar 23 11:31:43 -0400 2010:
> 
>> # mkdir -c <dir> (-c changedir)
>> or a new command
>> # mkcdir <dir>
> 
> This would (imho) be better handled as a shell function.  A (bash)
> example (needs more error/sanity checking):
> 
> function mkcdir() { mkdir "$1"; cd "$1"; }

It has to be a function of the shell,
since a command can can't the current dir
of it's parent (the shell).

I do this so often that I use a shorter name in my .bashrc:

md () { mkdir -p "$1" && cd "$1"; }

cheers,
Pádraig.


Reply via email to