On Mon, Oct 6, 2025 at 8:08 AM w f <wm_fry@yahoo.com> wrote:
>
> For 5.2.37(1)-release ...
>
> The example is somewhat contrived but its essence is pulled from an actual
> script I'm working on.
You should run your script through Shellcheck. It will help find
syntactical issues.
> a=1 b=1 c=10 d=11
> if [[ (-n $a && $c <= $d) || (-n $b && $c == $d) ]] ; then echo ok ; else
> echo no ; fi
> -bash: expected ')'
> -bash: syntax error near `$d)'
>
> Why does this give a syntax error?
>
> If I remove the space between "<=" and "$d" it works fine.
> If I replace the "<=" with ">=" (and keep the space after the "="), it fails.
> Any other operator ("<", ">","==","!=") with a spaces works fine.
Jeff