[PATCH] *.sh: Fix kornsh-ism test(1) invocations

Dimitri Papadopoulos Orfanos dimitri.papadopoulos at cea.fr
Fri Sep 16 07:16:42 PDT 2022


>> [...]
>> But for all the rest plain test(1) is sufficient.
> 
> What I'm really asking here is… what actual problem do these changes solve?
> [...]

These changes do not fix an actual runtime problem. Rather they fix a 
sort of "code documentation" problem. The current code seems to imply 
that regular expressions might be involved, because the compound 
statement [[ ... == ... ]] means that the string to the right of the 
operator is considered a pattern.

For regular strings, POSIX style [ ... = ... ] is the proper test to 
use, because we want the string to the right of the operator to be 
considered a string.

Besides it will trigger simpler and more efficient Bash code (plain 
strings instead of patterns).

-- 
Dimitri Papadopoulos



More information about the openconnect-devel mailing list