Execute commands directly after SSH connection

The following command establishes a connection to a server via SSH, executes some commands (for example, changes to a subdirectory and sends a git status ) and leaves the shell open. The .bashrc file is loaded, which enables colored subshells. The trick is to save a temporary file / tmp / initfile with the desired commands, to start a subshell (in our case bash) with the command --init-file. Within this initfile, the same file is deleted again immediately so as not to leave any traces.


ded8ef4a32a5fb8fb7a9c1b74a7d4279

Back