How to exit from SSH in LocalCommand?
ssh email@example.com 'cd foo/bar && rm *.foobar'
This will still print the output in the stdout but exit by default after executing the command.
Solution 2 :
Solution specific to your use-case : Based on the comment where you had mentioned, you will use ssh only for this ssh command,
You could edit the file called,
At the last line, just make all the commands, you want to execute, and then type exit
ls / > /tmp/output exit
This will run the command and exit the session
and you could just call it using,
ssh user@host , nothing else.
PS : This will only run the command and exit, remember, if you wanted to ssh into the system for anything, this would not let you, unless you remove the exit in the last line.