[Apple] Explanation /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/bin/bashexecutes a new instance of bash
-cpasses one or several commands to be executed
$(...)runs the command within
()and returns its result (Command Substitution)
curl ...gets the file specified in the URL
bash gets called to execute the content of the file fetched by
Some things you may try to understand this in more detail
curl ...to see what
curl ... | lessto examine it in more detail
/bin/bash -c 'echo "Welcome to bash"'
I want to add that if you're security conscious, you should never cut-n-paste such a command from a web site to run on your computer like that.
The HomeBrew project is a well-known and respected piece of software so I'm not saying that there is anything inherently wrong with installing it. However, their web site could be compromised in the future, where this command no longer performs as intended.
Also in general it is a good idea to not learn a habit of just cut-n-pasting commands like this to install software.
A security conscious way of handling this situation would be to download the
install.sh file to your computer first. Then you need to read it through and understand what it does - and only then run it. Note that it is not a good idea to merely browse the
install.sh file in a browser to determine that it is okay, as it is actually possible for a malicious server to detect whether or not you're browsing the script in a browser, or actually downloading to immediately execute it - and they could swap out the contents underneath you.
The main problem here is ofcourse that few people will know how to read and understand shell scripts.