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?

0

1 Answer 1

-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.

5
  • 2
    No, that's process substitution, not redirection.
    – cuonglm
    Feb 13, 2016 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, 2016 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, 2016 at 12:05
  • See also unix.stackexchange.com/questions/156084/…
    – cuonglm
    Feb 13, 2016 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, 2016 at 9:06

Not the answer you're looking for? Browse other questions tagged .