How to run a remote command in PuTTY after login in
Quoting the documentation:
The
-m
option performs a similar function to the ‘Remote command’ box in the SSH panel of the PuTTY configuration box (see section 4.18.1). However, the-m
option expects to be given a local file name, and it will read a command from that file.
And quoting section 4.18.1:
In SSH, you don't have to run a general shell session on the server. Instead, you can choose to run a single specific command (such as a mail user agent, for example). If you want to do this, enter the command in the ‘Remote command’ box.
Note that most servers will close the session after executing the command.
The word "instead" means that this is not a command to run in the shell before passing control to you. This is a command to run instead of a shell.
In your example, the echo
did its work somewhere unknown,
then the session terminated.
In short, you can't use -m
for executing commands
in the remote shell (because there is none).