From 880d95239e64f1dfd2b4fb49f32e1e0e59c69a67 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Mon, 24 Sep 2007 16:17:20 +0800 Subject: [EXPAND] Do not quote back slashes in parameter expansions outside quotes Test case: a=/b/c/* b=\\ echo ${a%$b*} Old result: /b/c/* New result: /b/c/ --- src/expand.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/expand.c') diff --git a/src/expand.c b/src/expand.c index db67c7c..3956112 100644 --- a/src/expand.c +++ b/src/expand.c @@ -895,7 +895,7 @@ memtodest(const char *p, size_t len, const char *syntax, int quotes) { int c = (signed char)*p++; if (c) { if ((quotes & QUOTES_ESC) && - (syntax[c] == CCTL || syntax[c] == CBACK)) + (syntax[c] == CCTL || syntax[c] == CDBACK)) USTPUTC(CTLESC, q); } else if (!(quotes & QUOTES_KEEPNUL)) continue; @@ -1671,9 +1671,8 @@ _rmescapes(char *str, int flag) } if (*p == (char)CTLESC) { p++; - if (notescaped && inquotes && *p != '/') { + if (notescaped && inquotes) *q++ = '\\'; - } } notescaped = globbing; copy: -- cgit 1.4.1