elif if cmp test.out outfile; then echo "test passed" elif diff -i test.out outfile; then echo "test passed (only just)" else echo "test failed" fi The -i option to diff ignores case ie: a more forgiving comparison