Advertisement
sergio_educacionit

for_file.sh

Jan 6th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. # evaluar el primer argumento
  2. # si no hay usar el directorio actual
  3. # si existe evaluar si tiene '/' al final
  4. # si no lo tiene agregarlo
  5.  
  6. ruta=${1:-./}
  7.  
  8. [[ "$ruta" =~ /$ ]] || ruta=${ruta}/
  9.  
  10. echo $ruta
  11.  
  12. for fichero in ${ruta}*;do
  13.  
  14. echo $fichero
  15.  
  16. done
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement