Article View: gnu.bash.bug
Article #76quoted quotes don't work.
From: Ray Moody
Date: Tue, 13 Jun 1989 21:15
Date: Tue, 13 Jun 1989 21:15
209 lines
4503 bytes
4503 bytes
Quoted quotes do not work in bash. For example
echo "a \"$PS2\" b" should print: a "bash>" b
but really prints: a bash> b
Ray
-------------------------------------------------------------------------------
RCS file: RCS/subst.c,v
retrieving revision 0.99.1.1
diff -c -r0.99.1.1 subst.c
*** /tmp/,RCSt1019034 Tue Jun 13 16:13:52 1989
--- subst.c Tue Jun 13 16:05:52 1989
***************
*** 1004,1012
}
case '"':
! index++;
! {
! WORD_LIST *tresult = (WORD_LIST *)NULL;
t_index = index;
temp = string_extract_double_quoted (string, &t_index);
--- 1004,1016 -----
}
case '"':
! /* Fixed Tue Jun 13 16:04:05 EST 1989 by Ray Moody */
! /* If a " is quoted, it is just an ordinary character */
! if (!quoted)
! {
! index++;
! {
! WORD_LIST *tresult = (WORD_LIST *)NULL;
t_index = index;
temp = string_extract_double_quoted (string, &t_index);
***************
*** 1008,1016
{
WORD_LIST *tresult = (WORD_LIST *)NULL;
! t_index = index;
! temp = string_extract_double_quoted (string, &t_index);
! index = t_index;
if (string[index])
index++;
--- 1012,1020 -----
{
WORD_LIST *tresult = (WORD_LIST *)NULL;
! t_index = index;
! temp = string_extract_double_quoted (string, &t_index);
! index = t_index;
if (string[index])
index++;
***************
*** 1012,1019
temp = string_extract_double_quoted (string, &t_index);
index = t_index;
! if (string[index])
! index++;
tresult = expand_string (temp, 1);
free (temp);
--- 1016,1023 -----
temp = string_extract_double_quoted (string, &t_index);
index = t_index;
! if (string[index])
! index++;
tresult = expand_string (temp, 1);
free (temp);
***************
*** 1015,1022
if (string[index])
index++;
! tresult = expand_string (temp, 1);
! free (temp);
if (tresult)
{
--- 1019,1026 -----
if (string[index])
index++;
! tresult = expand_string (temp, 1);
! free (temp);
if (tresult)
{
***************
*** 1018,1030
tresult = expand_string (temp, 1);
free (temp);
! if (tresult)
! {
! temp = savestring (tresult->word->word);
! dispose_words (tresult);
! }
! else
! temp = (char *)NULL;
add_quoted_string:
--- 1022,1034 -----
tresult = expand_string (temp, 1);
free (temp);
! if (tresult)
! {
! temp = savestring (tresult->word->word);
! dispose_words (tresult);
! }
! else
! temp = (char *)NULL;
add_quoted_string:
***************
*** 1026,1032
else
temp = (char *)NULL;
! add_quoted_string:
if (temp)
{
--- 1030,1036 -----
else
temp = (char *)NULL;
! add_quoted_string:
if (temp)
{
***************
*** 1028,1037
add_quoted_string:
! if (temp)
! {
! register char *tt;
! for (tt = temp; *tt && (*tt |= 0x80); tt++);
}
else
{
--- 1032,1049 -----
add_quoted_string:
! if (temp)
! {
! register char *tt;
! for (tt = temp; *tt && (*tt |= 0x80); tt++);
! }
! else
! {
! add_null_arg:
! temp = savestring (" ");
! temp[0] = (unsigned char)0x80;
! }
! goto add_string;
}
}
else
***************
*** 1033,1046
register char *tt;
for (tt = temp; *tt && (*tt |= 0x80); tt++);
}
! else
! {
! add_null_arg:
! temp = savestring (" ");
! temp[0] = (unsigned char)0x80;
! }
! goto add_string;
! }
break;
--- 1045,1053 -----
}
goto add_string;
}
! }
! else
! goto add_character;
break;
Technical Details
Message-ID:
<8906132115.AA19064@gibbs.physics.purdue.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!GIBBS.PHYSICS.PURDUE.EDU!rayShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!GIBBS.PHYSICS.PURDUE.EDU!ray From: ray@GIBBS.PHYSICS.PURDUE.EDU (Ray Moody) Newsgroups: gnu.bash.bug Subject: quoted quotes don't work. Message-ID: <8906132115.AA19064@gibbs.physics.purdue.edu> Date: 13 Jun 89 21:15:49 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 209