1. Q: sh: Can I quote '"' in a double quoted string?
I'm trying to reconcile some Bourne shell documentation (Solaris) with
Bourne shell's behavior.
The manpage says, regarding quoting:
"Inside a pair of double quote makrs (""), [...] \ quotes the
characters \, `, , and $. The pair \newline is removed before
parameter and command substitution. If a backslash precedes
characters other than \, `, , $, and newline, then the backslash
itself is quoted by the shell."
Note particularly the last sentence. This would suggest that:
$ echo " \" HELP! \" "
...would give you:
\" HELP! \"
...as output, right? This would be because a double quote mark is not
one of those characters which a backslash quotes, according to the
documentation. This seems like a load of hooey to me, because
everyone knows that if you type the example above you really get:
" HELP! "
...instead.
OR: is it possible that what's going on here is the following:
1. The string consisting of three spaces, '\"', one space, 'HELP!',
one space, '\"', three spaces is quoted by the shell. Since there are
no backslashed \, `, , or $ characters, the shell protects the
whitespace and passes the string as one argument to the echo command.
Thus, echo gets
<space><space><space>\"<space>HELP!<space>\"<space><space><space> as
its sole arguement.
2. The subshell that echo is running under does processing on the one
argument to echo, translating the '\"' sequences to '"'.
Unless I hear otherwise, I'm going to assume that you CAN backslash a
double quote mark inside a double quoted string in the Bourne shell,
and that the documentation is simply wrong not to mention this.
Cheers,
Laird
--
laird j. nelson (617) 252-5147
nets, incorporated 25 first street
http://www.amherst.edu/~ljnelson cambridge, ma 02141
2. Moving sendmail off the host.
3. replace single quote to double quote with an example
4. KDE menus messed up.
5. quoted strings within quoted strings
6. XF86 Font Problem...
7. Quoting quotes in m4?
8. keyboard screwup on pismo running debian sid
9. Double quotes within double quotes (no apostrophes)
10. Problem in sed using double quotes and single quotes
11. to quote or not to quote?
12. quoting quotes withion a (bourne shell) script line
13. quoting quotes, problem