有没有比“手表制造"更聪明的选择? [英] Is there a smarter alternative to "watch make"?

查看:70
本文介绍了有没有比“手表制造"更聪明的选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个有用的提示:如果您正在处理大量文件,并且希望它们自动生成,请运行:

I ran into this useful tip that if you're working on files a lot and you want them to build automatically you run:

手表制造

它每隔几秒钟就会重新运行一次,一切都建成了.

And it re-runs make every couple seconds and things get built.

但是...似乎一直吞没所有输出.我认为这可能更聪明-也许显示输出流,但抑制全部"不做任何事情,因此,如果未构建任何内容,则输出不会滚动.

However ... it seems to swallow all the output all the time. I think it could be smarter - perhaps show a stream of output but suppress Nothing to be done for 'all' so that if nothing is built the output doesn't scroll.

使用循环和grep可以想到一些shell脚本方法...但是也许还有更优雅的方法?有人看到过什么吗?

A few shell script approaches come to mind using a loop and grep ... but perhaps something more elegant is out there? Has anyone seen something?

推荐答案

此一线应该做到:

while true; do make --silent; sleep 1; done

它将每秒运行一次make,并且仅在实际执行操作时才打印输出.

It'll run make once every second, and it will only print output when it actually does something.

这篇关于有没有比“手表制造"更聪明的选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆