Ivam3

Hello.sh

Oct 15th, 2021
234
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. #Script de la practica I de la comunidad https://t.me/Ivam3byCinderella
  3. #En este script se obtiene el saludo correspondiente a la hora actual del sistema.
  4.  
  5. #DEFINIMOS LA VARIABLE HORA QUE CONTIENE LA HORA ACTUAL DEL SISTEMA                                      HORA=$(date|grep -oE '([0-9]{1,2}\:)([0-9]{1,2}\:)([0-9]{1,2})'|awk -F ":" '{print $1}')
  6.                                                                                                          #DEFINIMOS LA VARIABLE MINUTOS QUE CONTIENE EL MINUTO DE LA HORA DEL SISTEMA // EN EL SCRIPT NO SE USA PERO LO DEJO COMO DATO ADICIONAL
  7. MIN=$(date|grep -oE '([0-9]{1,2}\:)([0-9]{1,2}\:)([0-9]{1,2})'|awk -F ":" '{print $2}')
  8.  
  9. if [ $HORA -gt 00 ] && [ $HORA -lt 05 ]; then
  10.     printf "Buenas madrugadas\n"
  11. elif [ $HORA -gt 04 ] && [ $HORA -lt 12 ]; then
  12.     printf "Buenos dias\n"
  13. elif [ $HORA -gt 11 ] && [ $HORA -lt 19 ]; then
  14.     printf "Buenas tardes"
  15. else
  16.     printf "Buenas noches\n"
  17. fi
Advertisement
Add Comment
Please, Sign In to add comment