1

I was reading this script someone wrotte and there is this line:

comm -23 <(grep cat access.log) cats | mailx -s subject address@gmail.com

I understand it to mean convert this output as if it was a file but I just don't understand this syntax and I haven't seen it anywhere else.

Does this mean, execute grep in a sub shell and pipe the output back?

Ulukai
  • 195

1 Answers1

-1

< is a redirection operator. It takes the contents of the file/output from the right and pass it to the command to the left.

Khawar
  • 40
  • 2
    No, that's process substitution, not redirection. – cuonglm Feb 13 '16 at 11:51
  • yep, a redirection through < from a different process to the stdin of another process..which is same as saying the whole thing is a process substitution through a redirection. – Khawar Feb 13 '16 at 11:57
  • No, there's no redirection there. Process substitution make the output of grep as a file, then comm read from that file. Try echo <(:) for example. – cuonglm Feb 13 '16 at 12:05
  • See also http://unix.stackexchange.com/questions/156084/why-does-process-substitution-result-in-a-file-called-dev-fd-63-which-is-a-pipe – cuonglm Feb 13 '16 at 12:11
  • @cuonglm thank you, that answer was great. And sorry for double posting, hard to search in google for this question and get what you are looking for. – Ulukai Feb 16 '16 at 09:06