These Are Not the Same
tante.cc1 pointsby illo0 comments
([ a = b ] && echo "Oops!") || echo "Expected; phew!"
so if the command sequence after `&&` fails, then the code sequence after `||` is executed anyway: illo@joe:~ $ [ "a" == "a" ] && >/dev/full echo "strings match" || echo "strings don't match"
-bash: echo: write error: No space left on device
strings don't match
illo@joe:~ $
This is different from the semantics of the `if` block: illo@joe:~ $ if [ "a" == "a" ]; then >/dev/full echo "strings match"; else echo "strings don't match"; fi
-bash: echo: write error: No space left on device
illo@joe:~ $ grade(#student{work=Work, tried_hard=Tried}) -> grade1(Work, Tried).
grade1(excellent_work, _) -> 'a+';
grade1(okay_stuff, yes) -> b;
grade1(okay_stuff, _) -> 'b-';
grade1(_, _) -> c.
Edit: formatting.