Select

select is used to acquire user input in the form of a numbered menu.

 

The PS3 variable can be set for select's command prompt, to give a more meaningful prompt than the standard # or $

 

#!/bin/bash

bikes='Ducati Aprilia Triumph Yamaha Honda Quit'
PS3='Please select your favourite bike manufacturer, or 6 to quit: '
select bike in $bikes
do
if [ $bike == 'Quit' ]
then
break
fi
echo You selected $bike as your favourite make of motorbike
done