如何查看使用 grep 过滤的输出?

rub*_*o77 53 command-line grep gsettings watch-command

我想看输出的变化

gsettings list-recursively|grep text-scal
Run Code Online (Sandbox Code Playgroud)

这是

org.gnome.desktop.interface text-scaling-factor 1.0  
com.canonical.Unity.Interface text-scale-factor 1.0
Run Code Online (Sandbox Code Playgroud)

但如果我试着用

watch gsettings list-recursively|grep text-scal
Run Code Online (Sandbox Code Playgroud)

我没有输出,因为管道似乎是问题所在。

我怎样才能看到变化?

job*_*bin 71

您需要将管道命令用引号括起来,如下所示:

watch -n 2 'gsettings list-recursively|grep text-scal'
Run Code Online (Sandbox Code Playgroud)

这将会执行命令gsettings list-recursively|grep text-scalwatch它每两秒钟。请注意,时间间隔以秒为单位。

有关更多信息,请参阅手表的手册页