diff --git a/braces.c b/braces.c
index 2febed7..61c1ab1 100644
--- a/braces.c
+++ b/braces.c
@@ -529,6 +529,11 @@ brace_gobbler (text, tlen, indx, satisfy)
{
if (c == quoted)
quoted = 0;
+#if defined (SHELL)
+ /* The shell allows quoted command substitutions */
+ if (quoted == '"' && c == '$' && text[i+1] == '(') /*)*/
+ goto comsub;
+#endif
ADVANCE_CHAR (text, tlen, i);
continue;
}
@@ -551,6 +556,7 @@ brace_gobbler (text, tlen, indx, satisfy)
/* Pass new-style command and process substitutions through unchanged. */
if ((c == '$' || c == '<' || c == '>') && text[i+1] == '(') /* ) */
{
+comsub:
si = i + 2;
t = extract_command_subst (text, &si, 0);
i = si;