This is a multipart blog article series where I am going to explain the concepts of shell scripting and how to write a shell script in Linux, UNIX or Mac based systems. You can also follow this tutorial blog using windows but for that you have to install a bash from.
In this article we will see about select loop in shell scripting and how it is used.
- The syntax of select loop
select <variable_name> in list do command1 command2 commandN done
- The list item will be denoted by different numbers, and to select any specific item from that list you have to enter that number.
- Its structure is similar to for loop but the functionality is different.
- It will iterate over the list and give us the menu structure.
- We use select loop with case conditions, because in select loop we give choice to the user and in case condition we perform some task based to some choices
So this was a basic intro about select loop. Hope you liked it and learned something new from it.
If you have any doubt, question, quires related to this topic or just want to share something with me than please feel free to contact me.