I have the following bash script test.sh
#!/bin/bash
ssh -o "StrictHostKeyChecking no" user@$1
#do some stuff
exit
However if I run this script ./test.sh I need to enter ctrl+d to get out of the ssh session and it appears as if the exit command is not working the way I intended.
Is there any way I can exit this ssh session that was created from this bash script?