irctk

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

sync.sh (752B)


      1 #!/bin/bash
      2 
      3 trap 'kill $(jobs -p)' EXIT
      4 
      5 mkdir -p sync
      6 cd sync
      7 
      8 cat >tosay <<EOF
      9 /join #sync_test2
     10 [#sync_test1] /nick syncop2
     11 /mode +n
     12 /mode -n
     13 /part
     14 [#sync_test1,#sync_test2] /topic mytopic
     15 [#sync_test2] /invite syncc
     16 [#sync_test2] /kick syncc kickarg
     17 /say hello
     18 / /hello2
     19 /quit quitarg
     20 EOF
     21 (sleep 3; cat tosay) | ../irctk -p syncop@localhost \#sync_test1 \#sync_test2 2>/dev/null &
     22 sleep 1
     23 PID=$!
     24 tail -f /dev/null | ../../irctk -m syncm@localhost \#sync_test1 \#sync_test2 > heard_message &
     25 PID1=$!
     26 tail -f /dev/null | ../../irctk -c syncc@localhost \#sync_test1 \#sync_test2 > heard_command &
     27 PID2=$!
     28 tail -f /dev/null | ../../irctk -n syncn@localhost \#sync_test1 \#sync_test2 > heard_nothing &
     29 PID3=$!
     30 wait $PID
     31 sleep 1
     32 kill $PID1 $PID2 $PID3
     33