O'Reilly logo

Linux and Unix Shell Programming by David Tansley

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

25.3. Automating menus

Though here documents are great for creating menu screens you can also use them to automatically navigate a menu, instead of the user having to do it manually to select some process option.

I have a database menu script that takes care of all our database backups and administrative tasks. The database menu is used during the day to back up databases or run other administrative tasks. When it was decided to do all the database backups every night to be run from cron, I did not want to write another script. So I put together a here document that used its input to navigate the menu script called syb_backup. Here’s how the output of the menu script syb_backup looks.

I would have to press the following keys to be able to select ...

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