How to do recursively grep when there is a FIFO in the path
fifo, grep, shell
Solution
From `man grep` (GNU)
-D ACTION, --devices=ACTION
If an input file is a device, FIFO or socket, use ACTION to process it.
By default, ACTION is read, which means that devices are read just as if
they were ordinary files. If ACTION is skip, devices are silently skipped.
Problem
I want to do a recursively grep. So typically I will do the following: ``` grep pattern -r /some/path ``` Normally this will work. However, when there a FIFO file resides in the path, grep will stuck there. ``` johnson@ISD32_54_sles10:~/tmp$ ls -l 1 prw-r--r-- 1 neoli users 0 2012-05-16 17:24 1 ``` Then I call the strace command to identify the problem, I got this. ``` ... stat64("./1", {st_mode=S_IFIFO|0644, st_size=0, ...}) = 0 open("./1", O_RDONLY|O_LARGEFILE) = 3 read(3, <unfinished ...> ``` So my problem is how to do a recursively grep when there is a FIFO in the path? Does grep has a command line option which will tell grep to ignore FIFO when specified? Thanks for your kind help.