I have a very high level and complicated script which I basically need to debug with set -e on (because I'd like it not to run expensive operations in a loop as I work out the logic), but it is becoming difficult (even with set -x) to figure out exactly where the scripts are exiting due to an unexpected result.
I have about 3 scripts calling each other in various ways (combined with inotifywatch) so you can see how this gets a bit hairy.
I'm looking for something like "Script x.sh exited at line 4" rather than the uninformative [exited]