SSH using shell script terminates the script execution

Hello,

I am writing a shell script in which i do ssh to remote server and count the number of files there and then exit. After the exit the shell script terminates which i believe is expected behavior. Can some one suggest me a way where even after the exit the script execution resumes.

Thanks for the help.

Regards,
Ankit Anand

read about the nohup

Well, generally "nohup" would help you when exiting your terminal session that the script will continue to run, perhaps in conjunction with background &, while sending the output, by default, to "nohup.out" file.

However, there might be even easier way to do this - can you please tell us what your script does? Have you considered doing something like:

ssh user@server ls -l /path/folder | wc -l