diff --git a/source/src/commands/ssh.cpp b/source/src/commands/ssh.cpp index b411f25..70a2357 100644 --- a/source/src/commands/ssh.cpp +++ b/source/src/commands/ssh.cpp @@ -2,6 +2,7 @@ #include "config.hpp" #include "utils/utils.hpp" #include "utils/directories.hpp" +#include "utils/execute.hpp" #include "shared_commands.hpp" #include "servers.hpp" #include "services.hpp" @@ -48,7 +49,12 @@ namespace dropshell error << "Server " << server << " is not valid" << std::endl; return false; } - execute_ssh_command(server_env.get_SSH_INFO(user), sCommand(remotepath(server, user).DROPSHELL_DIR(), "ls --color && bash", {}), cMode::Interactive); + std::string dropshell_dir = remotepath(server, user).DROPSHELL_DIR(); + std::string bash_cmd = "ls --color && exec bash --rcfile <(cat ~/.bashrc 2>/dev/null; echo 'cd " + quote(dropshell_dir) + "')"; + + info << "SSHing into " << server << ":" << dropshell_dir << " as user " << user << std::endl; + + execute_ssh_command(server_env.get_SSH_INFO(user), sCommand(dropshell_dir, bash_cmd, {}), cMode::Interactive); return true; }