Created
October 19, 2010 00:34
-
-
Save jordansissel/633358 to your computer and use it in GitHub Desktop.
cd ../../../foo/bar is boring. 'up 3 foo/bar'
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 () { | |
if [ "$#" -eq 0 ] | |
then | |
echo "Up to where?" | |
return 1 | |
fi | |
times=$1 | |
target="$2" | |
while [ $times -gt 0 ] | |
do | |
target="../$target" | |
times=$((times - 1)) | |
done | |
cd $target | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment