I would like to be able to automatically run a command on a remote host each time I log into that host, but within the current interactive SSH session.
Something like
ssh user@remotehost [run do.sh]
where do.sh
does a couple of housekeeping tasks and then reattaches to a screen
session (currently I run do.sh
manually after logging into the host).
I don't want to add it to .bashrc
because I login to this host from other machines and I don't want do.sh
to run when I do login from there so I need it to be optional.
ssh user@remotehost /path/to/do.sh
? If it works, you can even alias it in .ssh/config or your personnal .bashrc