In the following days, or maybe years, I will go through the source code of all linux commands, to present you the principle of it's internal workflow.
Now the first one come here - watch:
Watch utility executes a program periodically, showing output fullscreen:
for(;;){ if (!(p = popen(command, "r"))) {...} //… print output of the command to terminal, using ncurses usleep(interval * 1000000); }
|
阅读(915) | 评论(0) | 转发(0) |