Linux shell basic Syntax B
Let's move on to the basics of shell programming.
This section starts with consolidating the use of redirects, creating your own file descriptors, and focusing on the use of temporary and permanent redirects in writing shell scripts.
(1)
< >>
In order to distinguish the redirection symbols above, you just need to understand the following two examples:
Cat > file fileA means that both stdout and stderr are redirected
For file descriptors, we not only need to master 0Jet 1 and 2, but also to be able to create our own file descriptors and combine them with the default standard file descriptors in shell programming. For example, restoring a file descriptor is an example.
Exec 3 > & 1
Exec 1 > testfile
...
...
Exec 1 > & 3
...
...
The above is the recovery of output redirection, and the input redirection is as follows
Exec 6