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: 
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

```
```
1 is stdout Standard Out
2 is stderr Standard Error
& indicates that what follows is a file descriptor and not a filename ("fold a file descriptor into another")

```

common code is redirect stdderr to stdout

```
2>&1

```

then

```
mycommand 2>&1 1>logfile

```

or

```
mycommand > afile.txt 2>&1

```