Closed PerfectSlayer closed 7 years ago
Your explanation is not exactly true: This is actually a bug of mksh, which stops the scripts when it hits a parse error, but this shouldn't be a parse error, just a standard call to [
Anyway, that's a really great fix, I was afraid of needing a higher complexity , thanks!
Thanks for the explanation! You're welcome. I'm glad to help 😉
Oh, I'm wrong, it's [[ not [, thus it is not just an external program execution. I still think it's not supposed to quit this way...
I'm being told your fix doesn't work. Have you successfully tested it on your side? I'm currently having someone test with "sh -c '[[ "toto2" =~ "toto" ]]' && good_expr=1"
I tested it on my side with my local shell (not mksh) and it worked fine. But you still have the syntax error log but the main script no more exits.
There is a problem with the "=~" operator support detection (and maybe the shell -e option). As the command fails, the script stops. So the command should be in a subshell if you would like to test its support without breaking the whole script.