Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #replace mkdir
- function mkdir() {command mkdir "$1" && cd "$1";}
- #check if folder exisits
- function mkdir() {
- if [ ! -d "$1" ];
- then
- command mkdir "$1" && cd "$1";
- else
- echo "$1 already exists.";
- fi;
- }
- #or in a one liner
- function mkdir() { [ ! -d "$1" ] && (command mkdir "$1" && cd "$1")|| echo "$1 already exists."; }
- #other options
- mcd() { mkdir "$1" && cd "$1"; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement