URI:
       0041-dc.sh - sbase - suckless unix tools
  HTML git clone git://git.suckless.org/sbase
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       0041-dc.sh (1700B)
       ---
            1 #!/bin/sh
            2 
            3 tmp1=$$.tmp1
            4 tmp2=$$.tmp2
            5 
            6 trap 'rm -f $tmp1 $tmp2' EXIT
            7 trap 'exit $?' HUP INT TERM
            8 
            9 cat <<'EOF' > $tmp1
           10 test 1:
           11 test 2:
           12 test 3:
           13 test 4:
           14 test 5:
           15 99
           16 test 6:
           17 1
           18 4
           19 test 7:
           20 in-macro
           21 after-macro
           22 test 8:
           23 inner
           24 after-all
           25 test 9:
           26 before
           27 after
           28 test 10:
           29 not-equal
           30 continued
           31 test 11:
           32 equal
           33 continued
           34 test 12:
           35 3
           36 2
           37 done
           38 test 12a:
           39 3
           40 done
           41 test 13:
           42 0
           43 1
           44 2
           45 done
           46 test 13a:
           47 0
           48 done
           49 test 14:
           50 deep
           51 outer
           52 final
           53 test 15:
           54 42
           55 test 16:
           56 done
           57 test 17:
           58 first
           59 last
           60 test 18:
           61 before
           62 test 19:
           63 before-q
           64 test 20:
           65 equal
           66 ../dc: stack empty
           67 ../dc: Q command argument exceeded string execution depth
           68 ../dc: Q command requires a number >= 0
           69 ../dc: Q command argument exceeded string execution depth
           70 EOF
           71 
           72 (exec 2>$tmp2
           73 $EXEC ../dc <<'EOF'
           74 [test 1:]pc Q
           75 [test 2:]pc 1Q
           76 [test 3:]pc  _1Q
           77 [test 4:]pc [100Q]x
           78 [test 5:]pc 99 [1Q]x p
           79 [test 6:]pc [[1p q 2p]x 3p]x 4p
           80 [test 7:]pc [[in-macro]p 1Q [not-printed]p]x [after-macro]p
           81 [test 8:]pc [[[inner]p 2Q [not1]p]x [not2]p]x [after-all]p
           82 [test 9:]pc [before]p 0Q [after]p
           83 [test 10:]pc [[equal-quit]p q]sa 5 3 =a [not-equal]p [continued]p
           84 [test 11:]pc [[equal-quit]p q]sa 5 5 !=a [equal]p [continued]p
           85 [test 12:]pc 3[[p 1- d 2 !>b 1Q]x]sb lbx [done]p
           86 [test 12a:]pc 3[[p 1- d 2 >b 1Q]x]sb lbx [done]p
           87 [test 13:]pc 0[[p 1+ d 2 !<b 1Q]x]sb lbx [done]p
           88 [test 13a:]pc 0[[p 1+ d 2 <b 1Q]x]sb lbx [done]p
           89 [test 14:]pc [[[[deep]p 2Q [x]p]x [y]p]x [outer]p]x [final]p
           90 [test 15:]pc [[42 q]x [x]p]x p
           91 [test 16:]pc [[1Q [not]p]x [done]p]x
           92 [test 17:]pc [[[first]p q q q]x [x]p]x [last]p
           93 [test 18:]pc [before]p q [after]p
           94 EOF
           95 
           96 $EXEC ../dc <<'EOF'
           97 [test 19:]pc [[before-q]p q [after-q]p]x [never]p
           98 EOF
           99 
          100 $EXEC ../dc <<'EOF'
          101 [test 20:]pc [[equal]p q]sa 5 5 =a [not-printed]p
          102 EOF
          103 cat $tmp2
          104 ) | diff -u - $tmp1