" and "&>" in bash? In bash, we have 3 types of stream: - 0 (STDIN) - 1 (STDOUT) - 2 (STDERR) So, while exe...">

What is the difference between ">" and "&>" in bash?

In bash, we have 3 types of stream:

  • 0 (STDIN)
  • 1 (STDOUT)
  • 2 (STDERR)

So, while executing some program, I can use control of these flows (for example, I can redirect them from the console to a file or smth, for example / dev / null, etc.):

command> / dev / null (only errors from STDERR will be shown, STDOUT will be moved to / dev / null) command 2> / dev / null (END STDOUT is displayed, STDERR will be moved to / dev / null)

I saw some people write command &> / dev / null

what's the difference between ">" and "&>" in bash?

+6
source share
1 answer

what is the difference between ">" and "&>" in bash?

This is a bugism that redirects both stdout and stderr . This can also be achieved with a more portable device:

 command > file 2>&1 
+10
source

Source: https://habr.com/ru/post/924253/


All Articles