0

我正在编写一个将执行的 bash 脚本

script -a logfile.log

如何将另一个命令传递给脚本生成的新 shell?例如,我想在执行此操作后通过 SSH 连接到主机,以便脚本记录我的 SSH 会话。我试过这个:

script -a logfile.log | ssh hosname

出现以下错误:

Pseudo-terminal will not be allocated because stdin is not a terminal.
4

2 回答 2

1
script -a logfile.log -c some-command

查看手册页以script获取其他选项。

在您的特定示例中,这可能是您正在寻找的内容:

script -a logfile.log -c ssh -t host run-something-else
于 2012-06-06T15:37:01.383 回答
0

可以忽略该警告,但 -T 选项应该摆脱它。

脚本-a logfile.log | ssh -T 主机名

于 2012-06-06T15:36:31.193 回答