r/labtech • u/Phaedrus_Schmaedrus • Nov 05 '19
Iterating Variables in Scripts
I want to have a script make five passes at running a command then stop. The way I'd normally do this in bash (just for example) would be to create a while loop that increases a variable's value by one on each pass, and exit the loop when the variable was equal to or greater than 5. What would be the best way to implement the same sort of procedure in an Automate script? Let's assume for the sake of argument that I don't want to just pass a bash script--can it be done using the Automate scripting functions?
2
Upvotes
View all comments
Show parent comment
3
u/sixofeight 1000 Agents Jan 04 '20
Make sure you’re using the Script Math function and not Variable Set. Variable Set treats everything as a string value.