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.

2 Responses to “Bash or Ruby for removing multiple Trac Spam Tickets”

  1. Robert J Lowe Says:

    Haha, nice, happy nuking those trac tickets, spam is getting crazy these days.

  2. Damien Says:

    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:

    I’ve not tried it yet, but it sure sounds interesting. :)