From 41552ba848ec72fd207ae6fba1ab97b55574c2f6 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 2 Aug 2015 18:56:41 +0300 Subject: [PATCH] .shellrc: add function mkcd --- .shellrc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.shellrc b/.shellrc index 85ca29e..eb741b1 100644 --- a/.shellrc +++ b/.shellrc @@ -138,6 +138,19 @@ include() } +function mkcd { + if [ $# -ne 1 ]; then + echo "Usage: mkcd directory_name" >&2 + elif [ -d "$1" ]; then + cd "$1" + elif [ -e "$1" ]; then + echo "Error: $1 is a file" >&2 + else + mkdir -p "$1" && cd "$1" + fi +} + + mc() { if [ -n "$SLOWTERM" ]; then MC_SLOW="--slow" -- 2.39.5