1 # @(#)precedence_test 1.0 91/07/24 Maarten Litmaath
2 # test of relative precedences for `&&' and `||' operators
4 echo "\`Say' echos its argument. Its return value is of no interest."
6 '') Say () { echo -n "$*" ; } ;;
7 *) Say () { echo "$*\c" ; } ;;
10 echo "\`Truth' echos its argument and returns a TRUE result."
16 echo "\`False' echos its argument and returns a FALSE result."
24 cmd1='$open $test1 && $test2 $close || $test3'
25 cmd2='$test1 || $open $test2 && $test3 $close'
36 for test1 in 'Truth 1' 'False 1'
38 for test2 in 'Truth 2' 'False 2'
40 for precedence in sh C
42 eval set x \$grouping_$precedence
50 read correct || { echo 'Input fubar. Abort.' >&2; exit 1; }
51 test "X$output" = "X$correct" || echo " correct=$correct"