tail -f并允许文本input

我想创build一个允许一些交互性的脚本

  • 从myService尾巴-f日志文件
  • 允许input文本并发送到myService

我还不能解决的是这两个function在一个terminal上并行工作。 我也想在TTY中实现一些我甚至不知道这个词的:

,-------------------------. | output here output here | | output here output here | |-------------------------| ( fixed input line here ) ------------------------- 

这甚至有可能通过SSH执行的服务器端bash脚本实现? 怎么样?

单独使用bash是不可能的,但是使用带有--tailboxfunction的dialog可能就是你正在寻找的东西。

在分离模式下使用screen或者tmux是否足够?

屏幕命令序列(默认键盘映射):

 screen - tail -f <logfile> ctrl-a shift-s ctrl-a <tab> ctrl-a c <send commands via shell> 

tmux的命令序列(默认键盘映射):

 tmux tail -f <logfile> ctrl-b " <send commands via shell> 

tail -f永远不会终止,这样就不可能了 – 没有工具可以知道何时添加固定的输出行。

但是,如果您等到写入日志文件,则可以使用直tail 。 我假设你想把组合发送到其他一些命令的标准input,大概是与你的提供者集成的。

 ( tail /var/log/logfile ; echo "Fixed output line here" ) | /usr/bin/nextcommand