Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个将执行的 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.
script -a logfile.log -c some-command
查看手册页以script获取其他选项。
script
在您的特定示例中,这可能是您正在寻找的内容:
script -a logfile.log -c ssh -t host run-something-else
可以忽略该警告,但 -T 选项应该摆脱它。
脚本-a logfile.log | ssh -T 主机名