如果我输入man tmux,/join-pane我会直接转到我正在寻找的子命令:
但如果我 grep 手册页,那么我什么也得不到:
$ man tmux | grep join-pane
$ echo $?
1
Run Code Online (Sandbox Code Playgroud)
如果我尝试一些不同的东西,那么它确实有效:
$ man tmux | grep 'terminal multiplexer'
tmux -- terminal multiplexer
tmux is a terminal multiplexer: it enables a number of terminals to be
Run Code Online (Sandbox Code Playgroud)
有关我的操作系统和我正在使用的命令的一些详细信息:
$ uname -a
Darwin home.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
$ grep --version
grep (BSD grep) 2.5.1-FreeBSD
$ man --version
man, version 1.6c
$ tmux -V
tmux 2.7
Run Code Online (Sandbox Code Playgroud)
根据关于这是一个终端问题的评论,我尝试了更多一些不起作用的模式:
$ man tmux | grep join\-pane
$ man tmux | grep "join-pane"
$ man tmux | grep 'join-pane'
$ man tmux | grep 'join\-pane'
$ man tmux | grep "join\-pane"
$ man tmux | grep -e join-pane
Run Code Online (Sandbox Code Playgroud)
尝试这个,
man tmux | col -b | grep -e 'join-pane'
Run Code Online (Sandbox Code Playgroud)
手册页具有缓冲对象,例如^H通过退格和重划来模拟粗体和下划线字符。
col将过滤掉这些缓冲区。您可以通过将手册页复制到文件中来检查差异。
带缓冲区:
man tmux > file1
Run Code Online (Sandbox Code Playgroud)
没有缓冲区:
man tmux | col -b > file2
Run Code Online (Sandbox Code Playgroud)