Skip to main content
deleted 111 characters in body
Source Link
Philippe A.
  • 2.9k
  • 2
  • 31
  • 38

The bash manpage says:

Redirecting Standard Output and Standard Error
Bash allows both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to be redirected to the file whose name is the expansion of word with this construct.

There are two formats for redirecting standard output and standard error:

&>word

and

>&word

Of the two forms, the first is preferred. This is semantically equivalent to

>word 2>&1

Why does the bash author say that &> is preferred over >&? I tend to use the >&first form because it is evocative of the concatenation 2>&1.preferred?

The bash manpage says:

Redirecting Standard Output and Standard Error
Bash allows both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to be redirected to the file whose name is the expansion of word with this construct.

There are two formats for redirecting standard output and standard error:

&>word

and

>&word

Of the two forms, the first is preferred. This is semantically equivalent to

>word 2>&1

Why does the bash author say that &> is preferred over >&? I tend to use the >& form because it is evocative of the concatenation 2>&1.

The bash manpage says:

Redirecting Standard Output and Standard Error
Bash allows both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to be redirected to the file whose name is the expansion of word with this construct.

There are two formats for redirecting standard output and standard error:

&>word

and

>&word

Of the two forms, the first is preferred. This is semantically equivalent to

>word 2>&1

Why is the first form preferred?

edited title
Link
John Kugelman
  • 357.7k
  • 69
  • 542
  • 584

How Why is `&>` semantically equivalent to `>word 2>&1`&> preferred over >&?

added 121 characters in body
Source Link
John Kugelman
  • 357.7k
  • 69
  • 542
  • 584

The bash manpage saysays:

   Redirecting Standard Output and Standard Error
       Bash allows both the standard output (file descriptor 1) and the 
       standard error output (file descriptor 2) to be redirected to the
       file whose name is the expansion of word with this construct.

       There are two formats for redirecting standard output and standard error:

              &>word
       and
              >&word

       Of the two forms, the first is preferred.  This is semantically equivalent to

              >word 2>&1

Redirecting Standard Output and Standard Error
Bash allows both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to be redirected to the file whose name is the expansion of word with this construct.

There are two formats for redirecting standard output and standard error:

&>word

and

>&word

Of the two forms, the first is preferred. This is semantically equivalent to

>word 2>&1

Why does the bash author sayssay that particular combination of operators &> is closer to >word 2>&1 thanpreferred over >&? I tend to use the second>& form because I find it very invocativeis evocative of the concatenation 2>&1.

The bash manpage say:

   Redirecting Standard Output and Standard Error
       Bash allows both the standard output (file descriptor 1) and the 
       standard error output (file descriptor 2) to be redirected to the
       file whose name is the expansion of word with this construct.

       There are two formats for redirecting standard output and standard error:

              &>word
       and
              >&word

       Of the two forms, the first is preferred.  This is semantically equivalent to

              >word 2>&1

Why the bash author says that particular combination of operators &> is closer to >word 2>&1 than >&? I tend to use the second form because I find it very invocative of the concatenation 2>&1.

The bash manpage says:

Redirecting Standard Output and Standard Error
Bash allows both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to be redirected to the file whose name is the expansion of word with this construct.

There are two formats for redirecting standard output and standard error:

&>word

and

>&word

Of the two forms, the first is preferred. This is semantically equivalent to

>word 2>&1

Why does the bash author say that &> is preferred over >&? I tend to use the >& form because it is evocative of the concatenation 2>&1.

had to clarify I know that all 3 forms can be used indifferently
Source Link
Philippe A.
  • 2.9k
  • 2
  • 31
  • 38
Loading
edited title
Source Link
John Kugelman
  • 357.7k
  • 69
  • 542
  • 584
Loading
Source Link
Philippe A.
  • 2.9k
  • 2
  • 31
  • 38
Loading