O'Reilly logo

Mastering Bash by Giorgio Zarrelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time to give our client a menu

In this chapter, we are looking at different ways to play with loops in order to work on the pieces of information the user provides us with. From a simple menu, we moved onto something fancier and better looking; and now, it is time to take a step further and have a look at the select construct whose task is to let us create menu in an effortless way. Its syntax is similar to the for construct:

select placeholder [in list]docommand_1command_2command_ndone

So, as we can see, this construct is very similar to for and sports a list, which gets expanded on the standard error in a series of elements preceded by a number. If we omit the in list part, the list gets constructed from the positional parameters given ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required