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


33

我想看输出的变化

gsettings list-recursively|grep text-scal

这是

org.gnome.desktop.interface text-scaling-factor 1.0  
com.canonical.Unity.Interface text-scale-factor 1.0

但是如果我尝试与

watch gsettings list-recursively|grep text-scal

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

我如何仍可以观看更改?

Answers:


42

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

watch -n 2 'gsettings list-recursively|grep text-scal'

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

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

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.