I use SSH Secure Shell client to connect to a server and run my scripts.
I want to stop a script on some conditions, so when I use exit, not only the script stops, but all the client disconnects from the server!, Here is the code:
if [[ `echo $#` -eq 0 ]]; then
echo "Missing argument- must to get a friend list";
exit
fi
for user in $*; do
if [[ !(-f `echo ${user}.user`) ]]; then
echo "The user name ${user} doesn't exist.";
exit
fi
done
A picture of the client:

Why is this happening?
You use
sourceto run the script, this runs it in the current shell. That means thatexitterminates the current shell and with that the ssh session.replace
sourcewithbashand it should work, or better puton to of the file and make it executable.