I know there are 3 streams attached to a process when it is run namely the input, output and error stream.
And redirection execution work from left to right.
I intend to execute a command, redirect its output stream to a file and its error stream to the same file as well.
-- nofile does not exists, text1 file does exists
head nofile text1 1> output.txt 2> output.txt -- I know this won't work. head nofile text1 1> output.txt 2>&1 -- while this will work, passing the error stream to the output ste
q1) Why ?
If it is a matter of "it is suppose to be written this way" then why can't the below work as well
head nofile text1 2>&1 1> output.txt head nofile text1 2>&1> output.txt
On the above i am redirecting the error stream to output stream, the output stream to the file. Its logic is the same as the above.