1 # @(#)precedence_test 1.0 91/07/24 Maarten Litmaath
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # test of relative precedences for `&&' and `||' operators
19 echo "\`Say' echos its argument. Its return value is of no interest."
21 '') Say () { echo -n "$*" ; } ;;
22 *) Say () { echo "$*\c" ; } ;;
25 echo "\`Truth' echos its argument and returns a TRUE result."
31 echo "\`False' echos its argument and returns a FALSE result."
39 cmd1='$open $test1 && $test2 $close || $test3'
40 cmd2='$test1 || $open $test2 && $test3 $close'
51 for test1 in 'Truth 1' 'False 1'
53 for test2 in 'Truth 2' 'False 2'
55 for precedence in sh C
57 eval set x \$grouping_$precedence
65 read correct || { echo 'Input fubar. Abort.' >&2; exit 1; }
66 test "X$output" = "X$correct" || echo " correct=$correct"