perms.sh 672 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. # file: recurse.sh
  3. # ====================================================================
  4. #
  5. # --------------------------------------------------------------------
  6. HOST=${HOSTNAME}
  7. MODE=6775
  8. OWNER=${USER}
  9. GROUP=plc
  10. # ====================================================================
  11. #
  12. # --------------------------------------------------------------------
  13. if [ ${HOSTNAME} != ${HOST} ]; then
  14. echo "This host is not ${HOST}."
  15. exit 1
  16. fi
  17. if [ -z ${1} ]; then
  18. echo "Specify full path to folder."
  19. exit 1
  20. fi
  21. for file in ${1}/*; do
  22. chown ${OWNER}:${GROUP} ${file}
  23. if [ -d ${file} ]; then
  24. echo ${file}
  25. chmod ${MODE} ${file}
  26. ${0} ${file}
  27. fi
  28. done