Let's say I have 5 variables in Bash:
foo
bar
goo
var
dog
I want to randomly pick ONE of these variables, set it to "1", and unset the rest of the variables to nothing, or 0, whichever.
I can definitely think of a way to do this with shuf, but it's going to be very un-elegant, and I was hoping to do this with more than 5 variables. So in other words, I'd like to see what you fellow people think of that won't be as a mess as what I envision doing.
Aucun commentaire:
Enregistrer un commentaire