there is a file, let's call it a reference file, you need to execute the script and compare the reference file with it, a file of 132 kb
result=$(./test.sh)| cmp -s $result test && echo 1||echo 0
I get the wrong output, the test file is identical to the script output, but I get 0
CodePudding user response:
Just pipe the script's output to cmp
.
./script | cmp -s - file