首页 > 解决方案 > 程序在输入之前启动

问题描述

man -k . | fzf -e --tiebreak=begin | awk '{print $1}' | xargs man -Tpdf | zathura -
# searches for a man page and then outputs it as pdf to zathura

这是命令,它工作得很好,除了 zathura 在等待标准输入给它输入时开始空白。必须将焦点从 zathura 转移回终端,然后再回到 zathura,这真的很烦人。

我对脚本相当陌生,所以我认为可能有一种我不知道的解决方法。

不管怎么说,还是要谢谢你!

标签: linuxshellpipezshpipeline

解决方案


我“解决”了我的问题,我将输出重定向到我的 /tmp/ 目录,然后从那里读取 zathura。我也把它全部放在一个脚本中。

   #!/bin/sh
   d=$(date +'%M_%S');
   man -k . | fzf -e --tiebreak=begin | awk '{print $1}' | xargs man -Tpdf > /tmp/man_${d};
   zathura /tmp/man_${d} 2> /dev/null &

推荐阅读