mkproject.sh 420 B

12345678910111213141516
  1. #!/bin/bash
  2. NAME=$1;
  3. if [ "$NAME" == "" ]; then
  4. echo "Need to pass a project name"
  5. exit 1
  6. fi
  7. TLD=$PWD
  8. GIT_HOME="/home/git/"
  9. PROJECT_SUFFIX=".git"
  10. PROJECT_DIR="$GIT_HOME/$NAME$PROJECT_SUFFIX"
  11. mkdir $PROJECT_DIR || echo "Couldn't mkdir $PROJECT_DIR"
  12. cd $PROJECT_DIR || echo "Couldn't cd to $PROJECT_DIR"
  13. $(which git) init --bare || echo "Couldn't init git in $PROJECT_DIR"
  14. cd $TLD || echo "Couldnt cd back up to $TLD"