Используйте встроенный оператор select
для меню:
#!/usr/bin/env bash
choices=(
"print home directory,Files,user id,login shell and date"
"generate 5 random number betweeon 0 to 100"
"print the min and max of the generated numbers"
"exit the program"
)
PS3='Enter your selection: '
while true; do
clear
echo "========================"
echo "Menu ----"
echo "========================"
select answer in "${choices[@]}"; do
# if the user entered a valid selection:
# - the "answer" variable will contain the _text_ of the selection,
# - the "REPLY" variable will contain the selection _number_
case "$REPLY" in
1) echo "do stuff for $answer..." ;;
2) echo "do stuff for $answer..." ;;
3) echo "do stuff for $answer..." ;;
4) exit ;;
esac
# we loop within select until a valid selection is entered.
[[ -n "$answer" ]] && break
done
read -p "Hit enter to continue..."
done