dgy
/
hexagons
Archived
1
0
Fork 0
This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
hexagons/.config/zsh/conf/11_up.plugin.zsh

21 lines
484 B
Bash

# Up, the Plugin
# Author: Peter Hurford
# https://github.com/peterhurford/up.zsh
up(){ # Go up X directories (default 1)
if [[ "$#" -ne 1 ]]; then
cd ..
elif ! [[ $1 =~ '^[0-9]+$' ]]; then
echo "Error: up should be called with the number of directories to go up. The default is 1."
else
local d=""
limit=$1
for ((i=1 ; i <= limit ; i++))
do
d=$d/..
done
d=$(echo $d | sed 's/^\///')
cd $d
fi
}