Linux How To's | Bash Scripting | Python

Wednesday, 9 October 2013

In some of my recent articles, I've been writing on Loop Statements in Linux Shell Scripting covering basic use of For, While and Until Loops. In these articles, we have seen what loops are, how they work and how they are used in BASH scripts. If you have not read them yet, you can do it now!

In this article, I will cover an another loop statement - 'Select' Loop. The select loop gives a simple way to generate a numbered menu and from this numbered menu user is asked to select the options. It is helpful when you want the user to select single or multiple options from a list of items

The 'Select' Loop

In any select loop, there will be a variable varName and a list of choices separated by a space. When the user chooses an option from the given choices, the value of the variable varName is set as the value of the selected option.