Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #!/bin/bash
  2. clear
  3. if [ $# -lt 2 ] || [ $# -gt 4 ]; then
  4.  
  5. echo "nieprawidlowa liczba argumentow"
  6.  
  7. elif [ ${#1} -ne 3 ]; then
  8. echo "nieodpowiednia dlugosc pierwszego znaku"
  9.  
  10. elif [ $1 -gt 777 ] || [ $1 -lt 0 ]; then
  11. echo "nieodpowiednia cyfra"
  12.  
  13. elif [[ $2 != "f" ]] && [[ $2 != "d" ]] && [[ $2 != "l" ]]; then
  14. echo "nieprawidlowa druga litera"
  15. elif [[ $3 != "f" ]] && [[ $3 != "d" ]] && [[ $3 != "l" ]] && [[ $3 != "" ]]; then
  16. echo "nieprawidlowa trzecia litera"
  17. elif [[ $4 != "f" ]] && [[ $4 != "d" ]] && [[ $4 != "l" ]] && [[ $4 != "" ]]; then
  18. echo "nieprawidlowa czwarta litera"
  19. else
  20. echo "PRZED"; ls -l
  21. echo "PO"
  22.  
  23. case "$2" in
  24. "f") find -type f -exec chmod -R $1 {} \;;;
  25. "d") find -type d -exec chmod -R $1 {} \;;;
  26. "l") find -type l -exec chmod -R $1 {} \;;;
  27. esac
  28.  
  29. if [ $# -gt 2 ]; then
  30. case "$3" in
  31. "f") find -type f -exec chmod -R $1 {} \;;;
  32. "d") find -type d -exec chmod -R $1 {} \;;;
  33. "l") find -type l -exec chmod -R $1 {} \;;;
  34. esac
  35. fi
  36.  
  37. if [ $# -gt 3 ]; then
  38. case "$4" in
  39. "f") find -type f -exec chmod -R $1 {} \;;;
  40. "d") find -type d -exec chmod -R $1 {} \;;;
  41. "l") find -type l -exec chmod -R $1 {} \;;;
  42. esac
  43. fi
  44. ls -l
  45. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement