Skip to content

Instantly share code, notes, and snippets.

@sborsje
Created April 30, 2011 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sborsje/949558 to your computer and use it in GitHub Desktop.
Save sborsje/949558 to your computer and use it in GitHub Desktop.
Switch projects
PROJECT_PARENT_DIRS[0]="$HOME/code"
for PARENT_DIR in ${PROJECT_PARENT_DIRS[@]} ; do
if [ -d "$PARENT_DIR" ]; then
for PROJECT_DIR in $(/bin/ls $PARENT_DIR); do
if [ ! -z `which $PROJECT_DIR` ]; then
continue # don't set alias if there is something already a command on the path with the same name
fi
if [ -d "$PARENT_DIR/$PROJECT_DIR" ]; then
alias "$PROJECT_DIR"="cd $PARENT_DIR/$PROJECT_DIR"
fi
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment