Using trap question

One of the scripts I'm working on, has a trap command at the very end.
tap "echo ${myname}: Deployment failure; exit 2" ERR

This command is present in a Script B, which is being called in the middle of another script A.

If the echo command is being executed, can we identify which line in which script (A or B) is giving the ERR signal?

Try putting a $0 in that string, which should ideally tell you the name of the script the trap was called in.

Putting the trap at the end seems pointless though. If you need it, you'd need it far earlier!

Thanks a lot for your valuable input.
I'll give it a try !! :slight_smile: