summaryrefslogtreecommitdiff
path: root/subst.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-12-03 13:52:48 -0500
committerChet Ramey <chet.ramey@case.edu>2011-12-03 13:52:48 -0500
commitbc7bed50995cf3500a3595ae353ad7e57ca8f755 (patch)
treec9cf5a1a58b1831f0f125115f6a382e1fb88be0a /subst.c
parent7027abcba9628e4c4db779a54e8a4dfc8eb1a668 (diff)
downloadbash-bc7bed50995cf3500a3595ae353ad7e57ca8f755.tar.gz
commit bash-20051027 snapshot
Diffstat (limited to 'subst.c')
-rw-r--r--subst.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/subst.c b/subst.c
index fe9d3b43..73887ab8 100644
--- a/subst.c
+++ b/subst.c
@@ -6839,12 +6839,16 @@ add_string:
{
t_index = sindex++;
- if (expanded_something)
- *expanded_something = 1;
-
temp = string_extract (string, &sindex, "`", EX_REQMATCH);
+ /* The test of sindex against t_index is to allow bare instances of
+ ` to pass through, for backwards compatibility. */
if (temp == &extract_string_error || temp == &extract_string_fatal)
{
+ if (sindex - 1 == t_index)
+ {
+ sindex = t_index;
+ goto add_character;
+ }
report_error ("bad substitution: no closing \"`\" in %s", string+t_index);
free (string);
free (istring);
@@ -6852,6 +6856,9 @@ add_string:
: &expand_word_fatal);
}
+ if (expanded_something)
+ *expanded_something = 1;
+
if (word->flags & W_NOCOMSUB)
/* sindex + 1 because string[sindex] == '`' */
temp1 = substring (string, t_index, sindex + 1);