I need to set random even number as function parameter in terminal:
soapy_power -b random_even_number
First step, I generate random number with shuf -i1-10 -n1
Next,I try to judge whether random number is even,if not 1
to this number.
What I tried and failed:
$(((shuf -i1-10 -n1) %2 -eq 0 OR (shuf -i1-10 -n1) 1))
How to generate random even number as parameter of function in bash one line command?
CodePudding user response:
Try
soapy_power -b "$(( RANDOM%5*2 2 ))"