Advertisement
sergio_educacionit

sh_perms.sh

Jan 6th, 2024
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # recorrer los ficheros de un directorio y asingar permisos de ejecucion a aquellos que no lo tengan, los ficheros que deben tener este permiso tienen la extension '.sh'
  4.  
  5.  
  6. ruta=${1:-./}
  7.  
  8. [[ "$ruta" =~ /$ ]] || ruta=${ruta}/
  9.  
  10.  
  11.  
  12. for fichero in ${ruta}*;do
  13.  
  14. if [ "${fichero: -3}" != ".sh" ];then
  15.  
  16. continue
  17.  
  18. fi
  19.  
  20. chmod +x $fichero
  21.  
  22.  
  23. done
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement