I'm trying to use cmp to compare outputs of two commands (Bourne shell):
cmp <(ls $file1) <(ls $file2)
It works well in Bash but cannot work in Bourne. Is there any solution? Thanks so much!
Process substitution is (or used to be) implemented using named pipes. You could use mkfifo
directly to recreate the same behavior:
mkfifo pipe1 pipe2
ls $file1 > pipe1 &
ls $file2 > pipe2 &
cmp pipe1 pipe2
rm pipe1 pipe2
But besides performances, you won't gain much compared to going thought regular files...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With