In this section, you will learn about handling files for reading and writing. In Chapter 8, Automating Decision Making in Scripts, you will learn about checking various attributes of files along with decision making constructs, such as if, case, and similar.
Introducing file handling
exec command is very interesting. Whenever we run any command in shell, the new subshell or process gets created, and the command runs in this newly created process. When we run any command as argument to the
exec will replace the current shell with the command to be executed. It does not create or spawn a new process to run the command.
Using exec to assign file descriptor (fd) to file
In the Bash shell environment, every process has three ...