O'Reilly logo

Linux Shell Scripting Cookbook by Sarath Lakshman

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

Automating interactive input

Automating interactive input for command-line utilities are extremely useful for writing automation tools or testing tools. There will be many situations when we deal with commands that read inputs interactively. Interactive input is the input typed by the user only when the command asks for some input. An example for execution of a command and supply of interactive input is as follows:

$ command
Enter a number: 1
Enter name : hello
You have entered 1,hello

Getting ready

Automating utilities which can automate the acceptance of input as in the above mentioned manner are useful to supply input to local commands as well as for remote applications. Let's see how to automate them.

How to do it...

Think about the sequence ...

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