1#!/bin/bash 2 3[ -f testing.sh ] && . testing.sh 4 5testing "expr integer" "expr 5" "5\n" "" "" 6testing "expr integer negative" "expr -5" "-5\n" "" "" 7testing "expr string" "expr astring" "astring\n" "" "" 8testing "expr 1 + 3" "expr 1 + 3" "4\n" "" "" 9testing "expr 5 + 6 * 3" "expr 5 + 6 \* 3" "23\n" "" "" 10testing "expr ( 5 + 6 ) * 3" "expr \( 5 + 6 \) \* 3" "33\n" "" "" 11testing "expr * / same priority" "expr 4 \* 3 / 2" "6\n" "" "" 12testing "expr / * same priority" "expr 3 / 2 \* 4" "4\n" "" "" 13testing "expr & before |" "expr 0 \| 1 \& 0" "0\n" "" "" 14testing "expr | after &" "expr 1 \| 0 \& 0" "1\n" "" "" 15testing "expr | & same priority" "expr 0 \& 0 \| 1" "1\n" "" "" 16testing "expr % * same priority" "expr 3 % 2 \* 4" "4\n" "" "" 17testing "expr * % same priority" "expr 3 \* 2 % 4" "2\n" "" "" 18testing "expr = > same priority" "expr 0 = 2 \> 3" "0\n" "" "" 19testing "expr > = same priority" "expr 3 \> 2 = 1" "1\n" "" "" 20testing "expr string becomes integer" "expr ab21xx : '[^0-9]*\([0-9]*\)' + 3" \ 21 "24\n" "" "" 22