bash stty:标准输入:使用 pdsh 或 ssh 时参数无效
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21428152/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
stty: standard input: Invalid argument when using pdsh or ssh
提问by Omer Dagan
I want to run a simple script from remote machine. The script contains the following:
我想从远程机器运行一个简单的脚本。该脚本包含以下内容:
#!/usr/bin/python
import os
print str(os.popen('stty size', 'r').read())
If I run it from local machine I get fine output, something like 36 138
. If I try to run it from another machine, I get <ip>: stty: standard input: Invalid argument
(using ssh ot pdsh).
如果我从本地机器运行它,我会得到很好的输出,比如36 138
. 如果我尝试从另一台机器上运行它,我会得到<ip>: stty: standard input: Invalid argument
(使用 ssh 或 pdsh)。
The problem is I can't change the script that is using the stty command. This is a common script, which I write wrapper to. Suggestions ?
问题是我无法更改使用 stty 命令的脚本。这是一个常见的脚本,我为它编写了包装器。建议?
采纳答案by Omer Dagan
As BroSlow said, ssh -t
will solve the problem if using ssh
.
正如 BroSlow 所说,ssh -t
如果使用ssh
.
If using pdsh
via ssh
, I used the following:
如果使用pdsh
via ssh
,我使用了以下内容:
export PDSH_SSH_ARGS_APPEND="-tt -q"
pdsh -w ${machine_list} -S -R ssh ${cmd}
PDSH_SSH_ARGS_APPEND
is used to append arguments to the ssh command generated by the pdsh
, as the name hints.
PDSH_SSH_ARGS_APPEND
pdsh
正如名称所暗示的那样,用于将参数附加到由 生成的 ssh 命令。