3 ms·
My favourite example in this page is used four times but not pointed out specifically. It's the use of <(some stuff) to create a temporary file descriptor. Sinc
by hiisukun 4y ago
My favourite example in this page is used four times but not pointed out specifically. It's the use of <(some stuff) to create a temporary file descriptor. Since it's not explained I'll give it a quick go.
If you ever found yourself doing something like this:
sort file1 > file1_sorted
sort file2 > file2_sorted
diff file1_sorted file2_sorted
You can instead skip making two new files, and do:
diff <(sort file1) <(sort file2)
And voila - you've got two 'files' you are comparing, but without having to save them to disk. The examples on the page use this with `curl` and `head` to good effect, but it wouldn't necessarily be obvious what's going on.