From e0398fd5c839c957cc8da8568bd86e4a822a9bea Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 14 Sep 2011 16:50:33 -0700 Subject: [PATCH] Function to go up n directories --- zshrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zshrc b/zshrc index 6332773..f60dc72 100644 --- a/zshrc +++ b/zshrc @@ -127,3 +127,13 @@ autoload mkmdir autoload pw autoload mkcmod +# Go up n directories (saves me from having to type ../ ad # nauseum) +function up { + if [[ -z $1 ]]; then + pushd .. + else + updirs=() + for (( i=0; $i < $1; i++ )); do updirs+='..' done + pushd ${(j./.)updirs} + fi +}