I needed to extract a shasum. This works, but can anyone explain why?
sed 's/^.*= //' -< <(openssl dgst -sha256 filename)
I'm familiar with the $( )
construct, but can't find docs for <( )
, coupled with -<
, which I assume is redirecting to the sed
STDIN.
I know there are easier ways, but this construct eludes me.
Best Answer
The
construct is a process substitution. It creates a file (or FIFO) behind the scenes and passes its name back to the command sequence.
is a regular file redirection, redirecting the contents of the behind-the-scenes file to
stdin
andis a placeholder recognized by
sed
to indicate that its input is coming fromstdin
.Since
sed
is perfectly capable of reading from files, the-<
seems unnecessary in this context;should work just as well.