3 ms·
I have a function for it which is quite useful: mcd () { mkdir "$@" cd "$@" } Just run mcd foobar and you (try) to create the directory and enter it. IMO
by mrud 16y ago
I have a function for it which is quite useful:
mcd () {
mkdir "$@"
cd "$@"
}
Just run mcd foobar and you (try) to create the directory and enter it. IMO a nice shortcut.
- pyre 16y agoYou know that mkdir can take multiple directories? If you run: mcd dir1 dir2 dir3 That function will run: mkdir "dir1" "dir2" "dir3" cd "dir1" "dir2" "dir3" (Surrounding $@ with double quotes, puts quotes around each item instead of quotes around the whole string: command "directory1/sub directory" "directory2" $@ => directory1/sub directory directory2 "$@" => "directory1/sub directory" "directory2" "$*" => "directory1/sub directory directory2" )