Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug with parameter expansion



Zefram wrote:

> Sven Wischnowsky wrote:
> >Tanaka Akira wrote:
> >> Maybe, `~' should be treated as `='?
> >
> >Yep.
> 
> Nope.  ~ in the middle of a word is special if EXTENDED_GLOB is set.

I was about to say:

I had exactly the same idea, had written the mail and the patch this
way and then checked. The `~' is only special if there are other glob
special characters. So I didn't change it.


... but of course, this isn't correct because bslashquote() doesn't
test if there are other special characters. Oh well...

Bye
 Sven

diff -u oldsrc/utils.c Src/utils.c
--- oldsrc/utils.c	Fri Nov  5 16:45:51 1999
+++ Src/utils.c	Fri Nov  5 16:46:19 1999
@@ -3075,8 +3075,9 @@
 	}
 	else if (ispecial(*u) &&
 		 ((*u != '=' && *u != '~') ||
-		  (u == s || (isset(MAGICEQUALSUBST) &&
-			      (u[-1] == '=' || u[-1] == ':')))) &&
+		  u == s ||
+		  (isset(MAGICEQUALSUBST) && (u[-1] == '=' || u[-1] == ':')) ||
+		  (*u == '~' && isset(EXTENDEDGLOB))) &&
 	    (!instring ||
 	     (isset(BANGHIST) && *u == (char)bangchar) ||
 	     (instring == 2 &&

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author