I have a simple script which i want to list some pre-filled choices or for the user to enter a number to correlate with a build
This is what I have currently.
read -p "Please select from the list below or enter the build number you would like to download " build
case {build} in
Latest)
build=lastSuccessful
break;;
*)
break;;
esac
The problem is that is doesn't provide a list for the user to choose.
Ideally it would look something like this
Build Choices 1) Latest 3) Successful 5) pick a build number (1-10000) 2) Stable 4) etc. Please select from the list above or enter the build number you would like to download: _
Or would it be better to do this in 2 case statements? Asking if they want to choose a particular build or enter their own.
UPDATE: After some thinking I ended up simplifying it to a yes no statement
while true;do
read -p "Would you like to download the latest successful build? (yes/no) " yn
case $yn in
[Yy]*)
echo
build=lastSuccessfulBuild
break;;
[Nn]*)
echo
read -p "Enter the build number to download: " build
break;;
*) echo 'I am not going to tell you again';;
[Qq]*) exit 0;;
esac
done