I have three files named One, Two, Three.
One contains:
1
3
2
Two contains:
4
6
5
Three contains:
7
9
8
When I give the following command:
$sort < One < Two < Three
I get the output:
7
8
9
But when I give the following command:
$sort One Two Three
I get the ouput:
1
2
3
4
5
6
7
8
9
Can anyone please shed light on what exaclty is happening here? Why does the input from 1 and 2 not taken into consideration in the first command?
You can't redirect multiple files with bash. To work around this limitation you could use cat:
On a side note, zsh supports what it calls mutlios:
Your command is the same as:
(file descriptor 0 is standard input)
Redirections are processed in the order they appear, from left to right.
sort
command itself cannot see any of those files.bash
open file1
,2
,3
atfile descriptor 0
one by one.So the right most one override left ones.
At last,
sort
read fromfile descriptor 0
which is bind to file3
.