Skip to content

Instantly share code, notes, and snippets.

@pieterv
Created January 10, 2012 02:04
Show Gist options
  • Save pieterv/1586368 to your computer and use it in GitHub Desktop.
Save pieterv/1586368 to your computer and use it in GitHub Desktop.
Navigate to a project code folder in a users Sites directory
# Move to site dir
function site()
{
# Colors
col='\e[41m'
txtrst='\e[0m'
# Find dir
cd ~ && cd "./Sites"
if [ $1 ]; then
if [ -d "./$1" ]; then
cd "./$1"
a=$(echo $1 | tr "[:lower:]" "[:upper:]")
printf "\n$col********************** Site $a ********************\n$txtrst"
if [ -d "./source" ]; then
cd "./source"
elif [ -d "./trunk" ]; then
cd "./trunk"
else
echo "No code directory found..."
fi
else
printf "'$col$1$txtrst' is not a valid project name\n"
echo "Projects:" && ls -Gd */
fi
else
printf "\n$col********************** Sites ********************\n$txtrst"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment