Advertisement
Guest User

Eneas

a guest
Oct 29th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.63 KB | None | 0 0
  1. num_parametros=$#
  2. ultimo_fichero=$(eval echo "\$$#.nuevo")
  3.  
  4. if [-f $ultimo_fichero ]
  5. then
  6.     echo "El fichero $ultimo_fichero ya existe, es condición que no exista"
  7.     exit 0
  8. fi
  9.  
  10. for n in $(seq 1 `expr $num_parametros - 1`)
  11. do
  12.     nombre_fichero_iteracion=$(eval echo "\$$n.nuevo")
  13.  
  14.     if [ ! -f $nombre_fichero_iteracion ]
  15.     then
  16.         echo "El fichero $nombre_fichero_iteracion no existe y es una condición requerida"
  17.         exit 0
  18.     else
  19.         echo "Param[$n] = $nombre_fichero_iteracion -> el fichero existe! ¡¡OK!!"
  20.     fi
  21. done
  22.  
  23. echo "Escribiendo parámetros en $ultimo_fichero"
  24. echo $num_parametros > $ultimo_fichero
  25. echo "[Finalizado]"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement