I have a two versions of a program, say : normalProgram
and bruteProgram
.
I have an input generator for both of these : programGenerator
Now I want to do this:
- Put the output of
./programGenerator
intoinput.txt
:./programGenerator > input.txt
- Redirect
input.txt
as the input ofnormalProgram
:cat input.txt | ./normalProgram
- Put the output of
./normalProgram
intoop1.txt
:(cat input.txt | ./normalProgram) > op1.txt
- Put the output of
- Similar thing for
./bruteProgram
:(cat input.txt | ./bruteProgram) > op2.txt
- Now I want to compare
op1.txt
andop2.txt
:diff op1.txt op2.txt
The whole command will look like this:
./programGenerator > input.txt &&
(cat input.txt | ./normalProgram) > op1.txt &&
(cat input.txt | ./bruteProgram) > op2.txt &&
diff op1.txt op2.txt
So this is a one time command.
I want to run this until diff op1.txt op2.txt
gives a non-empty response.
I tried putting diff op1.txt op2.txt
as the condition for until (or while, just to check whether the conditional is correct)
But this didn't work, and I got an error that, that is not a correct conditional.
Example:
while [diff normalOp.txt bruteOp.txt]
do
echo "hello"
done
This is giving me the error:
zsh: bad pattern: [diff