I need to find difference between 2 Cmd outputs. I found this Cmd for Linux but it is not working for Unix AIX server.
diff <(cmd1) <(cmd2)
Please let me know the equivalent UNIX command.
The command you refer to is using process substitution
, i.e. the <(...)
part. Essentially, it takes the output of the cmd1
and presents it as though it were a named file in the filesystem to diff
. It is a feature of the bash
shell, so, for a start you need to ensure you are using bash
and not sh
.
If that doesn't solve the problem, you could try downloading and installing the latest bash
for AIX.
If that doesn't work, you need to use 2 temporary files, something like this (or using mktemp
):
cmd1 > tmp1_$$
cmd2 > tmp2_$$
diff tmp1_$$ tmp2_$$
rm tmp?_$$