Read output of shell command from a file
From Notes_Wiki
<yambe:breadcrumb>Shell_operators|Shell operators</yambe:breadcrumb>
Read output of shell command from a file
It is always possible to use normal shell redirect such as:
ls > 1.txt ls -a > 2.txt diff 1.txt 2.txt
to get output of a command in a file and then give it as path to some other command.
But the same can be achieved using:
diff <(ls) <(ls -a)
What happens under the hood, is that two output file descriptors of the given commands are given to diff as input. Use:
echo diff <(ls) <(ls -a)
to understand this.
Since file descriptors are used unless a command is ready to accept input from a file descriptor, it may not work.