LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-16-2011, 10:05 PM   #1
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Rep: Reputation: 53
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.
 
Old 04-17-2011, 12:14 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Pretty weird, but still more readable than some. Here's a better explanation of bash quoting.
 
1 members found this post helpful.
Old 04-17-2011, 02:33 AM   #3
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
Quote:
Originally Posted by theKbStockpiler View Post
Is the author putting the characters inbetween a backquote and a single quote?
Yeah, it is an old relic from the ASCII era. Man pages are also chock full of these.

Quote:
Originally Posted by theKbStockpiler View Post
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 View Post
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
 
2 members found this post helpful.
Old 04-17-2011, 07:36 AM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
[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.
 
1 members found this post helpful.
Old 04-17-2011, 11:42 AM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by theKbStockpiler View Post
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.

Last edited by MTK358; 04-17-2011 at 11:44 AM.
 
1 members found this post helpful.
Old 04-17-2011, 12:21 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.

--- rod.

Last edited by theNbomr; 04-17-2011 at 12:25 PM.
 
1 members found this post helpful.
Old 04-17-2011, 01:01 PM   #7
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 148Reputation: 148
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.

Last edited by Telengard; 04-17-2011 at 01:05 PM.
 
1 members found this post helpful.
Old 04-20-2011, 10:14 PM   #8
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
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.
 
Old 04-20-2011, 10:30 PM   #9
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Original Poster
Rep: Reputation: 53
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What does symbol ^ do in bash? Mr. Alex Linux - Newbie 4 09-14-2010 10:48 AM
Help Requested with bash Parameter Substitution haleba Linux - Software 3 08-23-2010 01:37 PM
./firefox-bin :symbol lookup error:/lib/libgthread-2.0.so.0: undefined symbol: arulupsaras Linux - General 1 11-08-2008 04:48 AM
symbol lookup error: /usr/lib/libgtk-x11.2.0.so.0: undefined symbol:... IamI Slackware 17 02-29-2008 11:10 AM
bash assistance requested.. Ateo Programming 3 02-09-2005 06:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration