From 7e531c1a0f3d99836211ffa0fe93fb3fdd541010 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 18 Dec 2011 22:51:02 -0800 Subject: [PATCH] Update up() --- zshrc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zshrc b/zshrc index 37ad5c7..88719e8 100644 --- a/zshrc +++ b/zshrc @@ -139,14 +139,18 @@ autoload mkmdir autoload pw autoload mkcmod -# Go up n directories (saves me from having to type ../ ad # nauseum) +# Go up $1 directories, where $1 is an integer (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} + local updir='' + for (( i=0; $i < $1; i++ )) + do + updir="../$updir" + done + pushd $updir fi }