Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does >& mean?

I was a little confused by this expression:

gcc -c -g program.c >& compiler.txt 

I know &>filename will redirect both stdout and stderr to file filename. But in this case the ampersand is after the greater than sign. It looks like its of the form M>&N, where M and N are file descriptors.

In the snippet above, does M=1 and N='compiler.txt'? How exactly is this different from:

gcc -c -g program.c > compiler.txt     (ampersand removed) 

My understanding is that each open file is associated with a file descriptor greater than 2. Is this correct?

If so, is a file name interchangeable with its file descriptor as the target of redirection?

like image 585
contrapositive Avatar asked Jun 29 '12 02:06

contrapositive


People also ask

What does the fox say Meaning?

Speaking of the meaning of the song, Vegard characterizes it as coming from "a genuine wonder of what the fox says, because we didn't know". Although interpreted by some commentators as a reference to the furry fandom, the brothers have stated they did not know about its existence when producing "The Fox".

What does a real fox say?

The most commonly heard red fox vocalizations are a quick series of barks, and a scream-y variation on a howl. All fox vocalizations are higher-pitched than dog vocalizations, partly because foxes are much smaller. The barks are a sort of ow-wow-wow-wow, but very high-pitched, almost yippy.

How can I identify a song by sound?

On your phone, touch and hold the Home button or say "Hey Google." Ask "What's this song?" Play a song or hum, whistle, or sing the melody of a song. Hum, whistle, or sing: Google Assistant will identify potential matches for the song.


1 Answers

This is the same as &>. From the bash manpage:

Redirecting Standard Output and Standard Error This construct 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.

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 equiva- lent to         >word 2>&1 
like image 88
jordanm Avatar answered Oct 05 '22 13:10

jordanm