Using diff
to compare command output to a file
We know diff
can compare two files, but how can it compare the output of a command to a file? The answer is we use <( )
, which is called process substitution. We put the command inside process substitution, and it will convert the command’s output as a file so diff
can read it.
For example,
1 |
|