I am attempting to write a bash script that takes input from the keyboard and displays text depending on what number was entered:
#!/bin/bash
read -p "Enter your age: " AGE
case $AGE in
[1-12]*)
echo "You are just a child." ;;
[13-19]*)
echo "You are just a teenager." ;;
[20-29]*)
echo "You are a young adult." ;;
[30-39]*)
echo "You are a moderate age adult." ;;
*)
echo "You are really old."
esac
When you enter numbers like 3 or 4, it doesn't fall in the first range. It falls withing the 30-39 and the default.
Where am I messing up?
Asked by Randy Haley
(1 rep)
Feb 22, 2023, 03:23 PM
Last activity: Feb 22, 2023, 03:36 PM
Last activity: Feb 22, 2023, 03:36 PM