简体   繁体   中英

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.

你可以试试:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM