I was playing with bash a bit and was trying to assign a custom descriptor to a file to read from or write to.
Here is what i did:
exec 5> hello.txt # assigned 5 to hello.txt
echo "hello brother" >& 5 # works
Now the thing that i am not understanding is that if i do this instead
echo "some text" > 5 # does not work, creates a file named '5'
It does not work like the above >&.
I understand:
>&redirects stdout & stderr>redirects stdout
What is it that i am missing, is >& necessary when using descriptor?