Bash脚本'if'语句调用带参数的函数

use*_*330 2 linux bash shell

我想在我的bash脚本中使用if语句:

if [[ "$v" == "A" || my_func $x $y ]] ; then
Run Code Online (Sandbox Code Playgroud)

但我收到错误"条件二元运算符预期".我已经尝试在调用my_func的参数中引用参数,但仍然没有好处.尝试玩eval,这也没有帮助.

谢谢你的帮助.

kev*_*kev 7

你可以试试:

if [[ "$v" == "A" ]] || my_func $x $y ; then
Run Code Online (Sandbox Code Playgroud)