HPCE / hpce-2014-cw4

3 stars 5 forks source link

Diffing Outputs #14

Closed kronocharia closed 9 years ago

kronocharia commented 9 years ago

If I run " diff ../Outputs/step_world_reference.txt <(./make_world 10 0.1 | ./step_world 0.01 1)"

directly in the prompt things are fine, however invoking from a bash script tells me : "./test.sh: line 7: syntax error near unexpected token (' ./test.sh: line 7:if diff ../Outputs/step_world_reference.txt <(./make_world 10 0.1 | ./step_world 0.01 1)' "

m8pple commented 9 years ago

It looks like you have put the command into an if condition, so it looks something like:

if diff ../Outputs/step_world_reference.txt <(./make_world 10 0.1 | ./step_world 0.01 1) then
  # Error code
fi

The parser can't work out where the condition statement ends. Doing something like:

if ( diff ../Outputs/step_world_reference.txt <(./make_world 10 0.1 | ./step_world 0.01 1) ) then
  # Error code
fi

might fix it, or more normally you could use the last error code $? to do something like:

diff ../Outputs/step_world_reference.txt <(./make_world 10 0.1 | ./step_world 0.01 1);
if [ $1 -ne 0 ]; then
  # Error code
fi

(Disclaimer: haven't tried typing those in, and my bash is not create.)