Suppose that bash script X is being called within another bash script Y. If I directly execute script X on a local machine, after X's completion, the program exits to the terminal.
However, when I execute script Y remotely via SSH, the (remote) terminal "hangs" after X's completion and doesn't exit even if X contains an
exit command at the end.
How to make script Y to exit after completion of enclosed script calls, or move on to the next command when executed via SSH?
//scriptY.sh #!/bin/bash ... ssh -i $ssh_key $user@$host source $dir/scriptX.sh //scriptX completes fine on SSHed machine, but remote machine hangs here ...
Another detail, which may be helpful. Deeper inside there is this script being called, which contains