gpt4 book ai didi

linux - 获取 tmux 中其他 Pane 的标准输入

转载 作者:太空宇宙 更新时间:2023-11-04 11:50:38 25 4
gpt4 key购买 nike

我怎么能从 tmux 的另一个面板获得标准输入?我有这个测试脚本 (test_script):

echo "tell me something: "
read var
echo "said $var"

我发送要在面板 2 中执行的脚本:

tmux run-shell -t 2 'sh test_script'

但在面板 2 中,我得到的是:

tell me something: 
said

面板 2 跳过标准输入,我需要在面板 2 中使用标准输入,但我发现它不起作用,我该如何解决这个问题?

也试试管道:

tmux pipe-pane -o -t 2 'sh test_script > /dev/pts/12'

但我得到以下信息:

tell me something: 
hallo
No command 'hallo' found, did you mean:
Command 'hello' from package 'hello' (main)
Command 'hello' from package 'hello-traditional' (universe)
hallo: command not found

最佳答案

run-shell -t 仅控制显示输出的位置。管道 Pane 将发送 Pane 中的任何输出,而不是您在 Pane 中键入的任何内容。

您需要在 Pane 中实际运行您的脚本,这意味着替换它已经存在的内容。如果您喜欢新 Pane ,请使用重生 Pane 或拆分窗口。

关于linux - 获取 tmux 中其他 Pane 的标准输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56162003/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com