I have a korn 88 shell script which creates a folder on the remote host using the following command:
ssh $user@$host "mkdir -p $somedir" 2>> $Log
and after that transfers a bunch of files in a loop using this
scp -o keepalive=yes $somedir/$file $user@$host:$somedir
I wonder if first command will leave connection open after script ends?
Each of the commands opens and closes its own connection. It’s easy to use a tool like
tcpdumpto verify this.This is a consequence of the fact that the
exit()system call used to terminate a process closes all open file descriptors including socket file descriptors. Closing a socket closes the connection behind the socket.