Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux shell basic Syntax B

Shulou Source: shulou.com Published: 2022-06-03 03:56:21 09月28日 Update

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

Tags: Signals files scripts processes functions variables or content controls foundations locations examples commands real-time that is ways standards directories resources requirements Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Huawei Shulou Tech Info Linux Docker