_generic_create.sh 642 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. function _create() {
  3. echo "Removing exercice"
  4. rm -rf repo work
  5. echo "creating directories"
  6. mkdir -p repo work
  7. echo "initializing repository"
  8. cd repo
  9. git init --bare > /dev/null
  10. cd ..
  11. echo "cloning repository"
  12. cd work
  13. git clone ../repo . > /dev/null 2>&1
  14. echo "Initializing exercice"
  15. if [ "$2" == "debug" ]; then
  16. $1
  17. else
  18. $1 > /dev/null 2>&1
  19. fi
  20. cd ..
  21. echo ""
  22. echo "Exercice in $(pwd)/work/"
  23. echo "=========================================="
  24. cat readme.txt
  25. echo "=========================================="
  26. echo ""
  27. }