Advertisement
Derik_hacker

Untitled

Jul 17th, 2024
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.95 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Verifica che il numero di argomenti sia almeno 2
  4. if test $# -lt 3
  5. then
  6.     echo "Numero di parametri insufficiente"
  7.     exit 1
  8. fi
  9.  
  10. # Imposta la variabile CAR all'ultimo argomento
  11. CAR=${!#}
  12.  
  13. # Verifica che ciascun argomento (eccetto l'ultimo) sia un nome assoluto
  14. for i in "${@:1:$(($#-1))}"
  15. do
  16.     case $i in
  17.         /*)  if test ! -d $i -o ! -x $i
  18.                 then echo "$i non è una directory"
  19.                 exit 3
  20.                 fi;;  
  21.         *) echo "$i non è un nome assoluto"
  22.            exit 2;;
  23.     esac
  24. done
  25.  
  26. # Verifica che CAR sia un singolo carattere
  27. case $CAR in
  28.     ?) ;;
  29.     *) echo "$CAR non è un singolo carattere"
  30.        exit 3;;
  31. esac
  32.  
  33. # Aggiungi la directory corrente alla variabile PATH ed esportala
  34. PATH=$(pwd):$PATH
  35. export PATH
  36.  
  37. # Esegui lo script FCR2024.sh per ciascun argomento
  38. for abs in "${@:1:$(($#-1))}"
  39. do
  40.     echo "Stiamo esplorando $abs"
  41.     FCR2024.sh "$abs" "$CAR"
  42. done
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement