title: How to handle shell script if the terminal closes abruptly or terminal lost network connection?
body: <p>I have big bash script running but if due to some reason if the terminal closes (the one which is running the script) or due to some network issues the SSH connection lost or if user willingly gave Clt+c then how to capture the  above scenario. I want to log some message saying the script exited due to above reason.</p>