>>20
perl -F'<>' -lane 'print "$F[3] $F[4]" if((1..18) && $F[5] eq $ENV{name})' subject >list
This splits the downloaded subject.txt on "<>" delimiters and prints the thread# and post# if it's in the first 18 lines AND the name is "on" (this is the part where using subject.txt fails, I could add a tripcode verification by dl'ing the post in question...).
perl -lne 'print if system("grep -q \"$_\" done")' list >todo
Check if post has already been replied to, if not add to "todo" file.
perl -ne 'chomp; print `./post $ENV{board} $_ com`; sleep 15; `echo $_ >>done`' todo
This calls the post script, takes 4 args: board name, thread#, post#, comment file. Figure the rest out yourself.
if [ `perl -e 'print time-(stat("active"))[9]'` -gt 1800 ]; then rm active; fi
The file "active" is timestamped with the last post, this checks if it's been more than 1800 seconds.