Last active
August 28, 2015 20:45
-
-
Save NULLx76/6550a08c075df3027606 to your computer and use it in GitHub Desktop.
Bash function that goes up X directories. (for in your ~/.bashrc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
up(){ | |
local d="" | |
limit=$1 | |
for ((i=1 ; i <= limit ; i++)) | |
do | |
d=$d/.. | |
done | |
d=$(echo $d | sed 's/^\///') | |
if [ -z "$d" ]; then | |
d=.. | |
fi | |
cd $d | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment