Reputation: 2171
I have a template.
/path/to/script attribute >> /path/to/log
Need to add to a file that string from a template with "attribute" is numers, lets say, from 1 to 5.
/path/to/script 1 >> /path/to/log
/path/to/script 2 >> /path/to/log
/path/to/script 3 >> /path/to/log
/path/to/script 4 >> /path/to/log
/path/to/script 5 >> /path/to/log
How can i do that, comrads?
Thx in advance.
P.S. "attribute" will be an item in data bag.
Upvotes: 0
Views: 85
Reputation: 54267
Erb just uses standard Ruby code for loops so:
<%- (1..5).each do |n| -%>
/path/to/script <%= n %> >> /path/to/log
<%- end -%>
Upvotes: 3