Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created October 19, 2010 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordansissel/633358 to your computer and use it in GitHub Desktop.
Save jordansissel/633358 to your computer and use it in GitHub Desktop.
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