cd 命令失败时 ssh 会话退出

cd 命令失败时 ssh 会话退出

我使用 ssh 连接到远程主机。连接后,如果 cd 命令失败(如下所示),我的 ssh 连接会立即退出。我怎样才能防止这种情况发生?

scott@mac % ssh remotehost
Last login: Tue Jun 14 17:15:44 2022 from mac

scott@remotehost % cd aaaaaa
aaaaaa: No such file or directory.
Connection to remotehost closed.
scott@mac %

远程主机中的 shell 是西施。即使我使用不存在的文件名尝试使用其他命令cat,例如 等,也可以正常工作。ls

相关内容