0038-dc.sh (713B)
1 #!/bin/sh 2 3 tmp=$$.tmp 4 5 trap 'rm -f $tmp' EXIT 6 trap 'exit $?' HUP INT TERM 7 8 # Expected output for f, c, d, and r operators 9 cat <<EOF >$tmp 10 test 1: 11 test 2: 12 3 13 2 14 1 15 test 3: 16 0 17 test 4: 18 5 19 5 20 test 5: 21 3 22 3 23 2 24 1 25 test 6: 26 2 27 1 28 test 7: 29 2 30 3 31 1 32 test 8: 33 10 34 test 9: 35 1 36 test 10: 37 15 38 test 11: 39 test 12: 40 1 41 1 42 1 43 1 44 test 13: 45 -5 46 -5 47 test 14: 48 1.5 49 1.5 50 test 15: 51 2 52 3 53 1 54 EOF 55 56 $EXEC ../dc <<EOF | diff -u $tmp - 57 [test 1:]pc f 58 [test 2:]pc 1 2 3 f c 59 [test 3:]pc 1 2 3 c zp c 60 [test 4:]pc 5 d f c 61 [test 5:]pc 1 2 3 d f c 62 [test 6:]pc 2 1 r f c 63 [test 7:]pc 1 2 3 r f c 64 [test 8:]pc 5 d +p c 65 [test 9:]pc 1 2 r -p c 66 [test 10:]pc 5 d d + +p c 67 [test 11:]pc 1 2 3 c f 68 [test 12:]pc 1 d d d f c 69 [test 13:]pc _5 d f c 70 [test 14:]pc 1.5 d f c 71 [test 15:]pc 1 2 3 r f c 72 EOF