Skip to content

Instantly share code, notes, and snippets.

@kuckmc01
Created May 10, 2018 19:26
Show Gist options
  • Save kuckmc01/aaf1f0da4606a8813bd6326393373bc7 to your computer and use it in GitHub Desktop.
Save kuckmc01/aaf1f0da4606a8813bd6326393373bc7 to your computer and use it in GitHub Desktop.
goto script
#!/usr/bin/env bash
#setup
# in bash profile set an alias for goto alias='goto=. ./goto.sh'
# in bash profile set an alias for goback alias goback=$goback
# Usage:
# goto commonpath
#goto script for lazy people who dont want to have a lot of aliases or keep sourcing the bash profile
#Argument handling
case $1 in
commonpath)
LOCATION='my/common/path'
;;
esac
back=$(pwd)
goback="cd '${back}'"
CD="cd ${LOCATION}"
echo "going to: "
echo "'${LOCATION}'"
echo "type goback to go back to '${back}'"
${CD}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment