On the other hand, both the motivation and the effort seem out of place, out of whack: The criticism is that bash continues after errors and the examples used HAVE NO ERROR CHECKING!
Sorry for shouting, but this just boggles my mind. Someone is writing an entirely new language, with the intent of compatibility with another language, a significant effort, just because they don't want to
# dumb sample code that fails with spaces, etc.,
# just to get the point across....
handleCpError () {
errRc=$?
source=$1; target=$2
...
}
...
cp $file1 $file2 || handleCpError $file1 $file2
???Yes, this is a contrived example, but the whole argument in favour of newShellWithTryCatch seems contrived: shell scripting is programming; good programming requires foreseeing and handling errors; don't blame the shell if it doesn't die when you think it should if you are too lazy to understand and handle potential errors.
</sermon>