News for hackers. Stuff that matters.
Re:Shell Magic: Set Operations with uniq by partycoder on Tuesday May 29, 2018 @07:31PM (#17183655)
Can also use

    comm <flags> <(command 1) <(command 2)
To use the output of a command as input. This also works with diff and other commands.
Re:Shell Magic: Set Operations with uniq by TheDong on Tuesday May 29, 2018 @07:53PM (#17183770)
More accurately, it can be used for any command which expects a file and doesn't do anything too weird in reading it (e.g. doesn't seek to the beginning and read it again)

The '<( ... )' is just giving the path to that command's stdout as a file descriptor.

    $ ls <(echo hi)  
    /proc/self/fd/11
    $ vi <(echo hi)
    # opens vi with 'hi' as the contents
Re:Shell Magic: Set Operations with uniq by therein on Wednesday May 30, 2018 @04:20AM (#17186007)
Thank you. I was just thinking of looking into how it was implemented.
Re:Shell Magic: Set Operations with uniq by lloeki on Wednesday May 30, 2018 @08:28AM (#17187114)
It is called "process substitution", and can work the other way around:

http://www.tldp.org/LDP/abs/html/process-sub.html

With fish:

https://fishshell.com/docs/current/commands.html#psub

But there it only works one way:

https://github.com/fish-shell/fish-shell/issues/1786

Re:Shell Magic: Set Operations with uniq by scintill76 on Tuesday May 29, 2018 @07:56PM (#17183777)
Note that this is a bash feature; other shells may have different syntax.
Re:Shell Magic: Set Operations with uniq by hawski on Wednesday May 30, 2018 @08:44AM (#17187203)
It's the same in ksh at least, so one is covered in the BSDs. It could be also implemented as a separate tool, but not as convenient, because of additional quoting - I did once.
Re:Shell Magic: Set Operations with uniq by hawski on Wednesday May 30, 2018 @08:47AM (#17187221)
I use it in my frugal SSG project [0] to remove HTML files for every removed source file. It's great to use it this way as it doesn't use temp files.

[0] https://gist.github.com/hadrianw/060944011acfcadd889d937b960...