2023年1月18日(水) 9:59 Ruiyang Peng<rain@ryp.intirain.cc>:
It seems that bash's lexical is not so easy to change, so how about using
-eq, -gt, -lt etc like arithmetic? I think this might be a good solution.
As Lawrence has already pointed out, these operators are already used
for the arithmetic comparisons in [[ ... ]], but we could add
lexicographical operators with different names as, e.g., -leq, -lgt,
-llt, -lge, -lle. That would be another possible solution.
If we decide to support `<=' and `>=' for strings, to me, the cleanest
solution seems to be reorganizing the lexical rule inside [[ ... ]] to
accept <= and >= as single tokens though it would introduce
incompatibilities. I'm currently not sure if it's worth it. We need
more real use cases.
--
Koichi