Update up()

This commit is contained in:
Eryn Wells 2011-12-18 22:51:02 -08:00
parent 55d6796e7a
commit 7e531c1a0f

12
zshrc
View file

@ -139,14 +139,18 @@ autoload mkmdir
autoload pw autoload pw
autoload mkcmod 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 { function up {
if [[ -z $1 ]]; then if [[ -z $1 ]]; then
pushd .. pushd ..
else else
updirs=() local updir=''
for (( i=0; $i < $1; i++ )); do updirs+='..' done for (( i=0; $i < $1; i++ ))
pushd ${(j./.)updirs} do
updir="../$updir"
done
pushd $updir
fi fi
} }