A bash puzzle about thread redirection: `cat x> y <`

I was given the following bash puzzle without additional information about the meaning of the variables used.

cat x > y <

I assumed that x and y are files. In my bash, this fails (unexpected new line), so I tried something like this

ls *.txt >0; cat file1.txt > file2.txt <0;

As I understand it, this should put file1.txt in file2.txt, and then the result ls *.txt. This is not true. He puts only file1.txt. And this is not the case to be overwritten, as the result of the following will be the same:

ls *.txt >0; cat file1.txt >> file2.txt <0;

My question is:

  • Why is standard input redirection ignored?

  • why <at the end was incorrect, and should I have explicitly indicated <0? Shouldn't that be the default?

Update

, >0 >&0. .

+3
2

.

cat x > y <

, " "; - . x y - . , < .

ls *.txt >0; cat file1.txt > file2.txt <0;

cat stdin, ( - ). , , stdin.

cat file1.txt

. ,

cat file1.txt < 0

0.

< , < 0? ?

0 - . 0 . , ; .

< 0, 0 ( ) <&0, 0, ( <&0 ).

+3

.

" > 0"

"0". ,

ls *.txt >0; cat file1.txt > file2.txt <0;

.

+2

All Articles