Advertisement
sergio_educacionit

funcion.sh

Feb 3rd, 2025
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. saludar (){
  5.  
  6. # la funcion recoge su argumento con la variable
  7. # posicional $1
  8. echo hola $1
  9.  
  10. }
  11.  
  12.  
  13. hora() {
  14.  
  15. echo la fecha de hoy es_ $(date)
  16.  
  17. }
  18.  
  19.  
  20.  
  21.  
  22. read -p "Ingrese nombre: " nombre
  23.  
  24. echo "invocando funcion saludar..."
  25. sleep 0.5
  26.  
  27. # se le pasa el argumento a la funcion
  28. saludar $nombre
  29.  
  30.  
  31. echo "algunas instucciones..."
  32. sleep 0.5
  33. echo "otras instucciones..."
  34. sleep 0.5
  35.  
  36. echo 'invocando funcion hora'
  37. sleep 0.5
  38. hora
  39.  
  40. echo saliendo...
  41. sleep 0.5
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement