From 2ac6842720e7ace969d6d3a239546319f52a898e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 15 Sep 2024 22:13:46 +0200 Subject: [PATCH] sh: Add make-and-enter directory function `mcd` will, similarly to `md` create a directory and all the necessary top-level directories but, unlike `md`, afterwards also enter the created directory for the current shell. --- sh/.config/sh/alias | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sh/.config/sh/alias b/sh/.config/sh/alias index f316329..5ac00fa 100644 --- a/sh/.config/sh/alias +++ b/sh/.config/sh/alias @@ -40,6 +40,11 @@ alias ...="cd ../.." alias ~="cd ~" alias md="mkdir -p" +mcd() { + mkdir -p "$@" + cd "$1" || exit 1 +} + # clear my screen alias cl="clear"