Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Script de la practica I de la comunidad https://t.me/Ivam3byCinderella
- #En este script se obtiene el saludo correspondiente a la hora actual del sistema.
- #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}')
- #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
- MIN=$(date|grep -oE '([0-9]{1,2}\:)([0-9]{1,2}\:)([0-9]{1,2})'|awk -F ":" '{print $2}')
- if [ $HORA -gt 00 ] && [ $HORA -lt 05 ]; then
- printf "Buenas madrugadas\n"
- elif [ $HORA -gt 04 ] && [ $HORA -lt 12 ]; then
- printf "Buenos dias\n"
- elif [ $HORA -gt 11 ] && [ $HORA -lt 19 ]; then
- printf "Buenas tardes"
- else
- printf "Buenas noches\n"
- fi
Advertisement
Add Comment
Please, Sign In to add comment