Say I have too programs a
and b
that I can run with ./a
and ./b
.
Is it possible to diff their outputs without first w
Adding a little more to the already good answers (helped me!):
The command docker
outputs its help to STD_ERR
(i.e. file descriptor 2)
I wanted to see if docker attach
and docker attach --help
gave the same output
$ docker attach
$ docker attach --help
Having just typed those two commands, I did the following:
$ diff <(!-2 2>&1) <(!! 2>&1)
!! is the same as !-1 which means run the command 1 before this one - the last command
!-2 means run the command two before this one
2>&1 means send file_descriptor 2 output (STD_ERR) to the same place as file_descriptor 1 output (STD_OUT)
Hope this has been of some use.