newProfile.sh 534 B

12345678910111213141516171819202122232425262728293031
  1. # Script to create new profile from template
  2. USAGE="Usage: $0 <ARG1>
  3. ARG1: file_name"
  4. if [ $# -eq 0 ]; then
  5. echo "No arguments provided..."
  6. echo "$USAGE"
  7. exit 1
  8. fi
  9. if [ ! -d profiles ]
  10. then
  11. echo "Directory 'profiles' does not exist. Can't make new file."
  12. exit 1
  13. fi
  14. if [ -e profiles/profile_$1.go ]
  15. then
  16. echo "File already exists. Can't make new file."
  17. exit 1
  18. fi
  19. PROFILE=$1
  20. sed -e "s/PROFILE/${PROFILE}/" profileTemplate > profiles/profile_${PROFILE}.go
  21. echo "Created file profiles/lint_${PROFILE}.go"