Библиотека сайта rus-linux.net
Instead of controlling a loop by testing the result of a command or by user input, you can specify a file from which to read input that controls the loop. In such cases, read is often the controlling command. As long as input lines are fed into the loop, execution of the loop commands continues. As soon as all the input lines are read the loop exits.
Since the loop construct is considered to be one command structure (such as while TEST-COMMAND; do CONSEQUENT-COMMANDS; done), the redirection should occur after the done statement, so that it complies with the form
This kind of redirection also works with other kinds of loops.
In the example below, output of the find command is used as input for the read command controlling a while loop:
Files are compressed before they are moved into the archive directory.
Только зарегистрированные пользователи могут оценивать и комментировать статьи.