ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986
Rep:
BASH Symbol help Requested.
I would sort of like to know what double quotes will not escape in bash.
Quote:
3.1.2.3 Double Quotes
Enclosing characters in double quotes (`"') preserves the literal value of all characters within the quotes, with the exception of `$', ``', `\', and, when history expansion is enabled, `!'. The characters `$' and ``' retain their special meaning within double quotes (see section 3.5 Shell Expansions). The backslash retains its special meaning only when followed by one of the following characters: `$', ``', `"', `\', or newline. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an `!' appearing in double quotes is escaped using a backslash. The backslash preceding the `!' is not removed.
The special parameters `*' and `@' have special meaning when in double quotes (see section 3.5.3 Shell Parameter Expansion).
In particular
Quote:
with the exception of `$', ``', `\',
Is the author putting the characters inbetween a backquote and a single quote? So they mean the dollar-sign comma the back-quote comma and the back-slash Question-mark ending this sentence
I don't mean to be rhetorical but this is crazy.They are using computer grammar instead of Language grammar. I was just considering removing "Now there's the new and improved FTM."
This right here has to be the intergalactic symbol that Absolute Truth is fact! (`"')
Last edited by theKbStockpiler; 04-16-2011 at 10:26 PM.
So they mean the dollar-sign comma the back-quote comma and the back-slash
Exactly. The list also often (but not always) includes the exclamation point character, so only the first of
Code:
echo "Hello\!"
echo "Hello!"
will reliably echo Hello!.
Quote:
Originally Posted by theKbStockpiler
I don't mean to be rhetorical but this is crazy.
Yeah, but it is a trivial thing compared to Windows-1252 vs. ISO/IEC 8859-1. Microsoft decided to not use the then-proposed standard, but embrace and extend it. This is the reason non-Windows users so often see those question marks or rectangles instead of e.g. curly quotation marks. Mind you, the problem is solely with Windows, and Windows users; if they'd just care to be honest and say the content is windows-1252 (and not ISO/IEC 8859-1 as they so often claim), the text would show up correctly for everyone.
Last edited by Nominal Animal; 05-03-2011 at 09:23 PM.
Reason: Fixed the quote tag
[QUOTE=Nominal Animal;4326879]Yeah, it is an old relic from the ASCII era. Man pages are also chock full of these.
Speaking as an old relic of the ASCII era myself, I never used anything but the double-quote in formal writing. If you needed to emphasize something in those days you backspaced and printed the character again to make it darker, or backspaced and underlined. Converted docs from that era frequently drop the BS leaving:
Code:
While in C_h_i_c_a_g_o_ they continued work on the main project,
I'm sure troff still has the option to print this way, although there aren't many impact printers left.
s the author putting the characters inbetween a backquote and a single quote? So they mean the dollar-sign comma the back-quote comma and the back-slash Question-mark ending this sentence
I don't mean to be rhetorical but this is crazy.They are using computer grammar instead of Language grammar. I was just considering removing "Now there's the new and improved FTM."
It's pretty obvious from context that `' are not BASH special characters but quotation marks for the human reader. Why else would they be enclosing every spacial char in the list?
Seriously, you keep thinking too much about everything programming-related, trying to find some kind of deep meaning behind it which doesn't really exist. Programming is not nearly as philosophical as you think. Just use common sense.
The use of differing quotes in documentation is quite annoying, and all that, but I suggest that your best recourse is to simply understand what is being done, and then just live with it.
The way I understand it is that the use of `backticks` (or `backquotes`, if you prefer) is intended to somehow create a sort of visual symmetry with the corresponding 'forward quotes'. In some fonts/typefaces, this probably works, but in fonts that we seem to commonly adopt in computing, the effect comes out poorly. The use of quotes in typography is different from the use of quotes in programming languages. When the typography is intended to document the use of quotes in a programming language, the distinction just results in a horrible mess.
Now, it isn't really clear whether your question is about the use of quotation marks in the documentation or the use of quotation marks in the programming language that is part of bash, or both. If the question is about the use of quotes in bash programming, then I don't know if I could give a better answer than the man page excerpt that you've already posted. Perhaps you could elaborate on what is unclear to you, if such is the case. If you didn't understand the use of quotes in the documentation, I hope this post has explained some of that.
I will just add that there is yet another typographical phenomenon, where double quotes are composed by the use of ''two adjacent single quotes''. Messier still, and thankfully, I don't think any of these appear in common Unix/Linux documentation.
Many, many GNU documents use the convention that any text between ` (backquote or backtic) and ' (apostrophe or single quote) is to be taken as literal. It may seem confusing at first, but read enough documentation and you get used to it.
you see `echo'; you type echo
you see `&&'; you type &&
you see ``'; you type `
you see `''; you type '
One thing to be aware of is that this style of quoting may be rendered differently sometimes. Don't be surprised if HTML or PDF versions of the documents use these variations:
you see echo (no quote marks); you type echo
you see ‘&&’; you type &&
you see ‘`’; you type `
you see ‘'’; you type '
Use your own best judgment as to what is implied. Experiment and test as necessary to verify your understanding. You should be experimenting as you read along anyway, as that is the best way to learn.
Edit
My own convention for forum posts is that text which is to be taken literally should be bolded or enclosed in a code block. I do this because it seems more legible than cluttering my text with unnecessary special characters.
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986
Original Poster
Rep:
Thanks for the great replies! I mean it!
I had thought I figured it out but convinced myself I should bitch about it because other poor souls might be confused by this strange punctuation. Most of us prefer an actual affirmation and not assume what a piece of info means. It seemed totally weird in every way. You don't look at (`$') and think to yourself, "that has to make some kind of sense". What could the context possibly be that would make that appear to be logical? The back-quote and the single-quote are not opposites of eachother. I know it's in case you are reading in a reflextion and need to know which direction to read in! Ya thats it!
Thanks to everyone for explaining the history and context of the ` ' use. I had not idea that the background was that interesting.
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986
Original Poster
Rep:
I love this quote
Quote:
Seriously, you keep thinking too much about everything programming-related, trying to find some kind of deep meaning behind it which doesn't really exist. Programming is not nearly as philosophical as you think. Just use common sense.
I got the message MTK358. I will try to tune down my reading comprehension. I think it is because I'm just trying to find "A" meaning instead of none at all.
Last edited by theKbStockpiler; 04-20-2011 at 10:32 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.