user265330
user265330

Reputation: 2553

Bash script 'if' statement that calls a function with parameters

I want an if statement in my bash script that does:

if [[ "$v" == "A" || my_func $x $y ]] ; then

but I get the error "conditional binary operator expected". I've tried putting quotes round the parameters in the call to my_func, but still no good. Tried playing around with eval, which didn't help either.

Thanks for any help.

Upvotes: 2

Views: 9258

Answers (1)

kev
kev

Reputation: 161974

You can try:

if [[ "$v" == "A" ]] || my_func $x $y ; then

Upvotes: 7

Related Questions