lpost.sh (723B)
1 #!/bin/bash 2 3 trap 'kill $(jobs -p)' EXIT 4 5 mkdir -p lpost 6 cd lpost 7 8 cat > say <<EOF 9 [#lpost_testa] 1 10 [#lpost_testa] 2 11 [#lpost_testb] 3 12 [#lpost_testb] 4 13 [#lpost_testc] 5 14 [#lpost_testa] 6 15 [#lpost_testa] 7 16 EOF 17 cat say | sed 's/]/] <lposto>/' > ref 18 tail -f /dev/null | 19 ../../irctk lposti@localhost \#lpost_testa \#lpost_testb \ 20 \#lpost_testc > heard & 21 PID=$! 22 sleep 1 23 awk '{if ($1 == l) {print $2} else {print $0}} {l = $1}' say | tee said | 24 ../../irctk lposto@localhost -I 5 -p \#lpost_testa \#lpost_testb \ 25 \#lpost_testc 26 sleep 6 27 kill $PID 28 for chan in testa testb testc 29 do 30 if ! diff <(grep lpost_$chan ref) <(grep lpost_$chan heard) 31 then 32 exec diff <(grep lpost_$chan ref) <(grep lpost_$chan heard) 33 fi 34 done