Global variables in OpenHAB and non-repetitive rules

See Design Pattern: Associated Items for some inspiration. The easiest thing to do would be to put some sort of separator between the main part of the Item name and the number. Then you can split on that character and grab the last part. If the Item name is FeedTheCat_1 in the rule you can

val number = triggeringItem.name.split('_').get(1)

OH supports Jython, JavaScript, and Groovy as options. But you are still dealing with the Item name that triggers the rule.

See Rules | openHAB

In Rules DSL in OH 2.5, two copies of the rule will be running at the same time. In OH 3 or the other languages the triggers will be queued and run in FIFO.

Another approach, since you are just building is a command line, is to have just the one Item and configure to send the number as the command. Then you can use the Exec binding and link the input Channel to that Item and you don’t even need rules at all.