irctk

libircclient binding for scripts
git clone https://a3nm.net/git/irctk/
Log | Files | Refs | README

order2.sh (1037B)


      1 #!/bin/bash
      2 
      3 trap 'kill $(jobs -p)' EXIT
      4 
      5 mkdir -p order2
      6 cd order2
      7 
      8 cat >tosay <<EOF
      9 [#order2_test1] a
     10 [#order2_test1] b
     11 [#order2_test1,#order2_test2] c
     12 [#order2_test2,#order2_test1] d
     13 [#order2_test1] e
     14 [#order2_test2] e
     15 [#order2_test2] f
     16 [#order2_test1] f
     17 [#order2_test1] g
     18 [#order2_test3] a
     19 [#order2_test1,#order2_test3] h
     20 [#order2_test1] i
     21 [#order2_test2] g
     22 [#order2_test2] h
     23 [#order2_test2] i
     24 [#order2_test2] j
     25 [#order2_test3] i
     26 [#order2_test1,#order2_test2,#order2_test3] k
     27 [#order2_test1] l
     28 [#order2_test3,#order2_test2] l
     29 [#order2_test1,#order2_test2,#order2_test3] m
     30 EOF
     31 
     32 (sleep 4; cat tosay |
     33   ../../irctk -I 25 order2o@localhost \#order2_test1 \#order2_test2 \#order2_test3 2>/dev/null \
     34     > /dev/null) &
     35 sleep 1
     36 PID=$!
     37 tail -f /dev/null |
     38   ../../irctk order2m@localhost \#order2_test1 \#order2_test2 \#order2_test3 > heard_message &
     39 PID1=$!
     40 sleep 0.3
     41 wait $PID
     42 sleep 1
     43 kill $PID1
     44 
     45 diff <(sed 's/^[^,]*,[^,]*$/&\n&/' tosay |
     46   sed 's/^[^,]*,[^,]*,[^,]*$/&\n&\n&/' |
     47   cut -f2 -d' ' | sort) <(cut -f3 -d' ' heard_message)
     48