It’s often convenient to use the grep command to search header files for particular definitions and func-
tion prototypes. Suppose you need to know the name of the #defines used for returning the exit status
from a program. Simply change to the /usr/include directory and grep for a probable part of the
name like this:
$ grep EXIT_ *.h
...
stdlib.h:#define EXIT_FAILURE 1 /* Failing exit status. */
stdlib.h:#define EXIT_SUCCESS 0 /* Successful exit status. */
...
$
Here grep searches all the files in the directory with a name ending in .h for the string EXIT_. In this
example, it has found (among others) the definition you need in the file stdlib.h.
grep summary
最新推荐文章于 2021-05-09 11:09:55 发布