@ wrote... (3 years, 6 months ago)

I often want to make a directory and then immediately cd into that directory.

mkdir foo
cd foo

put the following in your .bashrc

function mcd()
{
    mkdir $*
    args=($*)
    cd ${args[@]:(-1)}
}

and then

source ~/.bashrc
mcd -p a/b/c/d
Category: tech, Tags: shell
Comments: 0
Click here to add a comment