irctk

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

order3.sh (685B)


      1 #!/bin/bash
      2 
      3 trap 'kill $(jobs -p)' EXIT
      4 
      5 mkdir -p order3
      6 cd order3
      7 
      8 cat >tosay <<EOF
      9 [#order3_test1] a
     10 [#order3_test1] b
     11 [#order3_test1,#order3_test2] c
     12 [#order3_test2,#order3_test1] d
     13 [#order3_test1] e
     14 [#order3_test2] e
     15 [#order3_test3] a
     16 EOF
     17 
     18 (sleep 4; cat tosay |
     19 ../../irctk -I 6 order3o@localhost \#order3_test1 \#order3_test2 \#order3_test3 > /dev/null)&
     20 sleep 1
     21 PID=$!
     22 tail -f /dev/null |
     23   ../../irctk order3m@localhost \#order3_test1 \#order3_test2 \
     24     \#order3_test3 > heard_message &
     25 PID1=$!
     26 sleep 0.3
     27 wait $PID
     28 sleep 1
     29 kill $PID1
     30 
     31 diff <(sed 's/^[^,]*,[^,]*$/&\n&/' tosay |
     32   sed 's/^[^,]*,[^,]*,[^,]*$/&\n&\n&/' |
     33   cut -f2 -d' ' | sort) <(cut -f3 -d' ' heard_message)
     34