Created
May 10, 2018 19:26
-
-
Save kuckmc01/aaf1f0da4606a8813bd6326393373bc7 to your computer and use it in GitHub Desktop.
goto script
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
#!/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