Lost with single and double quotes with bash!
I'm trying to automatize the installation of weighttp, a simple and light web server benchmark tool that is using libev.
I'm using Ubuntu Server 12.04.4 LTS without a GUI.
I wrote a little script (install-weighttp.sh) to do so, but the last part doesn't work.
However, I've read a number of documents with regard to bash and its quotes, but no one gave me a way to make what I expect to do.
I've try a number of combinations using the character \ before the single and/or the double quotes but I didn't find any one working !
Note: If I use all these commands, one after one in a terminal session, it works !
However, I'ld love to make the install-weighttp.sh script working too.
Any help will be trully appreciated because I'm a real dumb newbee with bash.
One secret is to stop thinking of quotes as enclosures, and more like toggle switches. They turn shell interpretation of characters on and off.* The only difference between single and double quotes is that double quotes continue to allow interpretation of a few characters, specifically "$,`,\", which allows parameter expansion and backslash escaping to continue happen. See the QUOTING section of the bash manpage for more details on how various characters are treated.
Another thing to understand is that pretty much everything the shell does, including quoting, only has one final purpose -- to create a list of arguments (tokens) for the command being run. Syntactical quotes are actually among the first things processed, and are removed from the line. Only if a quote mark is escaped by another quote or backslash will it become part of the argument itself. But the vast majority of commands do not accept literal quotes anyway.
As for this:
*Note that there are certain situations where nested containers create separate interpretation contexts. i.e.:
Thank you for all these precisions that solved my problem.
All the best.
|All times are GMT -5. The time now is 06:48 PM.|