We don't generally do requests for scripts here, but I'll help you with the difficult bit.
Assuming a shell with the
select functionality (such as
bash). This should get you started:
PS3='Select choice: '
select ch in "dog" "cat" "lion" "bear"; do
case $REPLY in
[1-4]) break ;;
*) echo 'Try again' >&2
printf 'You chose a %s\n' "$ch"
bash will display a menu and a prompt. The prompt is given by the value of the variable
select statement is a loop, and in each iteration, the user will have made a choice. The choice number (or whatever the user types) is in
$REPLY, and the actual menu item is in the variable given to the
select statement (here it's
case statement in the loop tests whether a valid response was given. If so (i.e.
$REPLY was a single digit between 1 and 4), we
break out of the loop. If any other thing was typed by the user, a short error message is printed and the loop runs its next iteration.
If you have more than 9 menu items, you may want to test for valid input in a more sophisticated way, since the
$REPLY value may have more than one character in it.
After the loop, the choice from the menu is available in