Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the meaning of 1 less than / dev/null 2 greater than & 1 in shell

2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces what is the meaning of 1 less than / dev/null 2 greater than & 1 in shell. It is very detailed and has a certain reference value. Interested friends must read it!

You may often see it in shell: > / dev/null 2 > & 1

The result of the command can be defined in the form of% >

/ dev/null stands for empty device file

> indicates where to redirect, for example: echo "123" > / home/123.txt

1 represents stdout standard output, and the system default value is 1, so "> / dev/null" equals "1 > / dev/null"

2 indicates stderr standard error

& indicates the equivalent meaning, 2 > & 1, indicating that the output redirection of 2 is equivalent to 1

Then the sentence in the title of this article:

1 > / dev/null first means that standard output is redirected to an empty device file, that is, no information is output to the terminal, to put it bluntly, no information is displayed.

2 > & 1 then, the standard error output redirection is equivalent to the standard output, because the standard output has been redirected to the empty device file, so the standard error output is also redirected to the empty device file.

The above is all the content of the article "what is the meaning of 1 less than / dev/null 2 greater than & 1 in shell". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 277

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report