Created
December 6, 2013 10:13
-
-
Save jgwhite/7821484 to your computer and use it in GitHub Desktop.
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 | |
function p() { | |
PROJECT_PATH=~/Sites | |
results=(`find $PROJECT_PATH -type d -maxdepth 3 -iname "*$1*"`) | |
count=${#results[@]} | |
if [ $count -gt 1 ]; then | |
echo "" | |
i=0 | |
while [ $i -lt $count ]; do | |
let num=$i+1 | |
echo "[$num] ${results[$i]}" | |
let i+=1 | |
done | |
echo "" | |
echo -n "Which project would you like to open [1]: " | |
read choice | |
if [ ! -n "$choice" ]; then | |
let num=0 | |
else | |
let num=$choice-1 | |
fi | |
echo "" | |
cd ${results[$num]} | |
elif [ $results ]; then | |
project=${results[0]} | |
cd $project | |
else | |
echo "Project '$1' not found" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment