bash - Exit from an SSH session but not script -


in bash script, do:

ssh me9@some_mad_server.com; cd ~/apple; echo "before exit" exit echo "after exit" 

i never see before exit or after exit. can understand why may not see before exist script @ stage in console. confused if exit mean script ends , hence why after exit never gets logged.

any appreciated.

to execute series of commands on remote host, need pass them ssh on command line, not execute them after ssh call. this:

ssh me9@some_mad_server.com '     cd ~/apple     echo "before exit" ' echo "after exit" 

this uses multiline string pass multiple commands. exit implicit when end of string reached.

importantly, commands in quoted string executed on remote host, while final echo executed on local server. i've indented remote commands clarity.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -