How can i differentitate if the return code ($?) came from the ssh command itssef or from the command to be executed remotely when using the following syntax:
ssh user@host "some remote command"
From the man page
ssh exits with the exit status of the remote command or with 255 if an error occurred
so anything that's not 255 must have come from the remote command.