Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 使用ssh-J传播退出代码_Bash_Shell_Ssh - Fatal编程技术网

Bash 使用ssh-J传播退出代码

Bash 使用ssh-J传播退出代码,bash,shell,ssh,Bash,Shell,Ssh,我想知道在使用-J选项时,是否有办法通过ssh获取远程命令的结果代码 -J destination:通过首先与目的地描述的跳转主机建立ssh连接,然后建立到最终目的地的TCP转发,连接到目标主机 在正常会话中获取它很简单: ssh-Tuser@server.example.com这似乎是OpenSSH中的一个bug。我怀疑这是因为jumphost隧道在最终目标隧道之后关闭,因此最终退出状态来自jumphost连接,而不是最终目标(您关心的目标)。不过,我不知道该如何应对。我想您可以echo$?作

我想知道在使用
-J
选项时,是否有办法通过ssh获取远程命令的结果代码

-J destination
:通过首先与目的地描述的跳转主机建立ssh连接,然后建立到最终目的地的TCP转发,连接到目标主机

在正常会话中获取它很简单:


ssh-Tuser@server.example.com这似乎是OpenSSH中的一个bug。我怀疑这是因为jumphost隧道在最终目标隧道之后关闭,因此最终退出状态来自jumphost连接,而不是最终目标(您关心的目标)。不过,我不知道该如何应对。我想您可以
echo$?
作为远程命令中的最后一件事,并捕获它,但这相当麻烦。在LinuxMint/19(openssh_7.6p1)上,它可以按预期工作。检查ssh-T-jlocalhost localhost…
。代理服务器上较旧版本的ssh可能有问题。@dash-o Doing
ssh-T-Juser@proxy.example.com user@proxy.example.com这似乎是OpenSSH中的一个bug。我怀疑这是因为jumphost隧道在最终目标隧道之后关闭,因此最终退出状态来自jumphost连接,而不是最终目标(您关心的目标)。不过,我不知道该如何应对。我想您可以
echo$?
作为远程命令中的最后一件事,并捕获它,但这相当麻烦。在LinuxMint/19(openssh_7.6p1)上,它可以按预期工作。检查ssh-T-jlocalhost localhost…
。代理服务器上较旧版本的ssh可能有问题。@dash-o Doing
ssh-T-Juser@proxy.example.com user@proxy.example.com