Skip to content

Instantly share code, notes, and snippets.

@kevinzhang96
Created November 9, 2015 16:14
Show Gist options
  • Save kevinzhang96/7067588c95c38c3a57bf to your computer and use it in GitHub Desktop.
Save kevinzhang96/7067588c95c38c3a57bf to your computer and use it in GitHub Desktop.
A short shell script to make switching between folders in a directory easier.
# repository navigation shortcut
nav(){
# list all directories in ~/Repositories
DIRS=`ls -l ~/Repositories | egrep '^d' | awk '{print $9}'`
# and now loop through the directories:
for DIR in $DIRS
do
if [[ $DIR = $1* ]]
then
cd ~/Repositories/$DIR
break
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment