I'm trying to understand the following command:
user$ bash < <(curl -s https://something.com )
What do the < <
do?
2.2. Double Brackets. The double brackets, [[ ]], were introduced in the Korn Shell as an enhancement that makes it easier to use in tests in shell scripts.
<( Angle Parentheses ) Meaning that you can do things like: diff two streams. run a command within a shell to create an input-"file" for other commands that want input in the form of a file rather than a stream.
The square brackets ( [ ] ) indicate that the enclosed element (parameter, value, or information) is optional. You can choose one or more items or no items. Do not type the square brackets themselves in the command line. Example: [global options], [source language=”arguments”][/source]
Braces are used for function bodies and objects. And brackets are used for lists or array notation. In Bash, that's often a little different and in many cases, parentheses, braces, and brackets act as commands themselves. So it can take a little getting used to if you're coming from other languages.
It's not < <
but first <
which means input redirection and then <( ... )
which means run the command inside the braces and make from that a file argument.
This looks to me quite equivalent as
curl -s https://something.com | bash
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With