Skip to content

Instantly share code, notes, and snippets.

@proshanto
Created July 28, 2015 09:13
Show Gist options
  • Select an option

  • Save proshanto/9dbd58a20ee60a17c226 to your computer and use it in GitHub Desktop.

Select an option

Save proshanto/9dbd58a20ee60a17c226 to your computer and use it in GitHub Desktop.
function cdProject() {
projectDir="/var/www/projects"
if [ $# -lt 2 ]; then
echo -e "Argument #1 should be personal or work\n"
echo -e "Argument #2 should be the name of the directory to cd into from personal or work directory."
return 1
fi
if [ $(pwd) != "$projectDir/$1/$2" ]; then
cd $projectDir/$1/$2;
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment