Input
Many UNIX programs are interactive and read input from the user. To use such programs in shell scripts, you need to provide them with input in a non-interactive manner. Also, scripts often need to ask the user for input in order to execute commands correctly.
To provide input to interactive programs or to read input from the user, you need to use input redirection. In this section, you will look at the following methods in detail:
Input redirection from files
Reading input from a user
Redirecting the output of one command to the input of another
Input Redirection
When you need to use an interactive command, such as mail in a script, you need to provide the command with input. One method for doing this is to store the input of the command ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access