What does the syntax of pipe and ending dash mean? [duplicate]
Disclaimer. I'm a long-time Windows user and just starting to get my head around the Linux paradigm. While excited by it, I understand that my formulations might be poorly chosen due to ignorance.
I've received an answer, the contents of which included the following line, which I need help interpreting (after a while of googling I've got a pretty good guess but I'd like to make it more reliable).
curl -sL https://blabla | sudo -E bash -
I understand that we first create a web call to the URL blabla and then (here's the pipe magic popping up) execute a command with admin elevated privileges to open a new terminal window instance.
However, when I try to digest the command, I learn that it's equivalent to the following sequence.
curl --silent --location https://blabla
sudo -E bash -
Question 1: Is that correctly understood?
Further on, I tried to learn what the switches for the second line are and used the statement as follows.
man bash | sed -n '/-E/,+1p'
However, I can't really see what "-E" is shorthand for (is it --empty or is it -- or maybe --err) and get stuck on the interpretation. Also, I can't figure out what the alone dash character does and I'm not sure how to look it up in the manual using the statement above.
Question 2: How do I look up the verbose syntax for the switches?
Question 3: What is the meaning of the dash character without the switch?
The pipe command (|) means take the output of the command on the left and pass it in as input to the command on the right. So, you are almost correct in your understanding of what
curl -sL https://blabla | sudo -E bash -
does. What you are missing is capturing the output of the first command, and passing that into the second command. What you have above needs to be something like the following:
curl --silent --location https://blabla >/tmp/output
sudo -E bash - </tmp/output
The dash (-) at the end of the second command is just telling bash to read in standard in and process it. So,
sudo -E bash - </tmp/output
is equivalent to
sudo -E bash </tmp/output
The "-E" option is actually associated with sudo, not with bash. Running the command:
man sudo
shows that -E preserves the environment.
Hope this helps clarify some things for you.
Good luck with learning linux! :)