Sample Header Ad - 728x90

SSH session termination on script error when sourcing multiple sub-scripts

2 votes
1 answer
432 views
I'm facing an issue with SSH on a server. Running individual scripts (source s01.sh, etc.) works fine, with errors displayed in the console. However, when using a master script to source these scripts, the SSH connection unexpectedly terminates upon encountering an error. The master script master.sh is as follows: #!/bin/bash set -e source s01.sh source s02.sh Rscript s03.R source s04.sh I source the master script in interactive SSH session using source master.sh With set -e, I expect the script to stop at errors, but instead, it's causing the entire SSH session to drop. This only happens with the combined script, not with individual sourcing. Why does this occur, and how can I keep the SSH session from closing on script errors? I am aware this might involve SSH server configurations, but I'm unsure which settings to investigate.
Asked by jay.sf (237 rep)
Nov 26, 2023, 09:38 AM
Last activity: Nov 26, 2023, 01:38 PM