November 2015
Beginner
282 pages
5h 5m
English
The select, while and until loops are also used to loop and iterate over each item in a list or till the condition is true with slight variations in syntax.
The select loop helps in creating a numbered menu in an easy format from which a user can select one or more options.
The syntax of the select loop is as follows:
select var in list do # Tasks to perform done
The list can be pre-generated or specified while using the select loop in the form [item1 item2 item3 …].
For example, consider a simple menu listing the contents of '/' and asking a user to enter an option for which you want to know whether it is a directory or not:
#!/bin/bash # Filename: select.sh # Description: Giving user choice using ...
Read now
Unlock full access