I don't quite understand how the computer reads this command.
cat file1 file2 1> file.txt 2>&1
If I understand, 2>&1 simply redirect Standard Error to Standard Output.
By that logic, the command reads to me as follows:
concatenate files
file1andfile2.send
stdoutfrom this operation tofile.txt.send
stderrtostdout.end?
I'm not sure what the computer's doing. By my logic, the command should be
cat file1 file2 2>&1 > file.txt
but this is not correct.
$stand for? – Eliran Malka Jun 24 '19 at 14:28var=$othervar,$introduces the variable name on the right hand side. In a redirection like2>&1,&introduces the file descriptor number on the right hand side. I'm saying you can think of it like "file 2 equals file 1". (But there are two types of equals:<means "for reading" and>means "for writing".) – Mikel Jun 25 '19 at 15:481or2you understand the difference between2>1and2>&1per @Mikel Also, I appreciate the mental translation, it works for me.1>&2becomes1 = $2which syntactically "sort of" means something in bash, RegEx, and probably Perl. – razzed Sep 16 '20 at 16:39