Hi again,
Jenkins run the above shebang by default:
But if you run scripts and other scripts without trapping those errors then IMO the root cause is basically in the scripts itself, so if those scripts don't handle those errorlevels accordingly then you won't be able to track those error, I'm afraid I don't know how electric commander works, but jenkins does solve those error tracking accordingly and generally, but for specific cases error tracking should be, IMO, managed by the scripts rather than any tools, but this is another topic out of this thread.
Using shell scripts for building/testing/compiling are a kind of non-standard way of doing automatic tasks, if you use gradle/maven/ant/nant/.... then those errorlevels will be managed accordingly. It's not a trivial change for old legacy systems, but that's probably something else.
Let's see if someone else can provide another way of solving it.
Cheers