Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Función para determinar el signo zodiacal
- get_zodiac_sign() {
- month=$1
- day=$2
- case $month in
- 1)
- if [ $day -ge 20 ]; then
- echo "Acuario"
- else
- echo "Capricornio"
- fi
- ;;
- 2)
- if [ $day -ge 19 ]; then
- echo "Piscis"
- else
- echo "Acuario"
- fi
- ;;
- 3)
- if [ $day -ge 21 ]; then
- echo "Aries"
- else
- echo "Piscis"
- fi
- ;;
- 4)
- if [ $day -ge 20 ]; then
- echo "Tauro"
- else
- echo "Aries"
- fi
- ;;
- 5)
- if [ $day -ge 21 ]; then
- echo "Géminis"
- else
- echo "Tauro"
- fi
- ;;
- 6)
- if [ $day -ge 21 ]; then
- echo "Cáncer"
- else
- echo "Géminis"
- fi
- ;;
- 7)
- if [ $day -ge 23 ]; then
- echo "Leo"
- else
- echo "Cáncer"
- fi
- ;;
- 8)
- if [ $day -ge 23 ]; then
- echo "Virgo"
- else
- echo "Leo"
- fi
- ;;
- 9)
- if [ $day -ge 23 ]; then
- echo "Libra"
- else
- echo "Virgo"
- fi
- ;;
- 10)
- if [ $day -ge 23 ]; then
- echo "Escorpio"
- else
- echo "Libra"
- fi
- ;;
- 11)
- if [ $day -ge 22 ]; then
- echo "Sagitario"
- else
- echo "Escorpio"
- fi
- ;;
- 12)
- if [ $day -ge 22 ]; then
- echo "Capricornio"
- else
- echo "Sagitario"
- fi
- ;;
- *)
- echo "Fecha de nacimiento inválida"
- ;;
- esac
- }
- # Solicitar el nombre de la persona
- read -p "Ingrese el nombre de la persona: " name
- # Solicitar la fecha de nacimiento (DIA y MES)
- read -p "Ingrese la fecha de nacimiento (DIA MES): " date
- # Extraer el día y el mes de la cadena de entrada
- day=$(echo $date | cut -d ' ' -f1)
- month=$(echo $date | cut -d ' ' -f2)
- # Obtener el signo zodiacal
- sign=$(get_zodiac_sign $month $day)
- # Mostrar el resultado
- echo "El signo zodiacal de $name es: $sign"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement