I want my bash script to execute random command of given below.
For example
[mysterious command] ("command1", "command2", "command3")
bashrandom
I want my bash script to execute random command of given below.
For example
[mysterious command] ("command1", "command2", "command3")
Best Answer
This should accomplish what you're looking for.
Takes the array and uses
shuf
to generate a random command.UPDATE: Changed shuf command per @steeldriver