Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cd ../../../foo/bar is boring. 'up 3 foo/bar'
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