Bash or Ruby for removing multiple Trac Spam Tickets
I had to clean up a public Trac ticket db where anonymous tickets are allowed. I had to issue commands like this:
trac-admin . ticket remove 58
I keep forgetting the shell syntax for doing a loop over numbers. But actually a ruby script was just right for the task:
ruby -e "(49..75).each{|i| %x(sudo -u www-data trac-admin . ticket remove #{i})}"
This shows some of my reasons to love Ruby: Very intuitive syntax. And faster than to lookup bash syntax.
September 28th, 2009 at 22:29 (GMT-1)
Haha, nice, happy nuking those trac tickets, spam is getting crazy these days.
September 29th, 2009 at 01:11 (GMT-1)
Indeed ruby is very easy to use for that. So I thought you may be interested in the ruby shell called Rush, you can find it there: http://adam.blog.heroku.com/past/2008/2/19/rush_the_ruby_shell/
I’ve not tried it yet, but it sure sounds interesting. :)