Question: What does this do? I cannot find any information about what `&1` and `&2` are in `bash`.

```
$ echo "Hello" >&1
Hello

$ echo "Hello" >&2
Hello

$ echo "Hello" >&3
bash: syntax error near unexpected token `&'

```

I know that you can redirect standard and error output to a file, but what does the ampersand do in these cases?

Answer: 
`>&` is a variant on the `>` pipeline operation. While `>` redirects output into a named file (or the device's representation in the filesystem, such as `/dev/console`), `>&` redirects the output to one of the standard output streams. The most commonly used exaples are stream 1 (stdout) and stream 2 (stderr). Note that these are the same numbers you can use in front of the `>` or `>&` operators to say which stream's output you want to redirect.

`echo "hello" >&1` is redundant; you're redirecting stdout to stdout.
(`echo "hello" 1>&1` would mean the same thing, of course.)

A more interesting example: `echo "hello" 2>&1` redirects the echo command's error output from stderr to stdout, combining them into a single stream. This one is often useful if you want to run all the output through a single pipe rather than having them treated separately. `echo "hello" 2>&1 | tee log`, for example, captures a copy of both normal output and error messages into a single log file. 

BroSlow points out that, in version 4 and later of the `bash` shell, `|&` can be used as a shorthand for combining the streams, equivalent to `2>&1`. Good to know. (I still move between shells too frequently to have started using that one.)
Bash has several file descriptors used for input and ouptut. 

* **1** is stdout
* **2** is stderr
* **3-9** can be used for other i/o (for example if you're using 1 to read from a file in a file loop, you can use 3 to read user input)
* **10+** is generally used by bash internally, though can be requested from bash if needed

Now for your examples, it's probably easier to view if you split the `&` from the file descriptor. Both `>&` and `>&` are functionally equivalent and redirect from a given file descriptor to another. So in your examples:

*The echo command will print whatever you give it to stdout (1), which in this case you redirect to stdout, so the redirection doesn't change anything.* 

```
$ echo "Hello" >& 1

```

*The output of the echo command is redirected, and instead of going to stdout goes to stderr.* 

```
$ echo "Hello" >& 2

```

*The output of the echo command is redirected, and instead of going to stdout bash tries to send it to file descriptor 3, however it hasn't been allocated yet, so bash throws an error.* 

```
$ echo "Hello" >& 3    

```

*You can allocate it to /dev/stdout for example, and then get the same result as your first redirection example.*

```
$ exec 3<> /dev/stdout
$ echo "Hello" >& 3
Hello

```