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

Re: globbing in the repeat-count word gives "illegal character"



This is straightforward.  There is no reason to propagate tokens.

diff --git a/Src/loop.c b/Src/loop.c
index 95ef48b33..f13c8c4a9 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -499,8 +499,10 @@ execrepeat(Estate state, UNUSED(int do_exec))
 
     lastval = 0;
     tmp = ecgetstr(state, EC_DUPTOK, &htok);
-    if (htok)
+    if (htok) {
 	singsub(&tmp);
+	untokenize(tmp);
+    }
     count = mathevali(tmp);
     if (errflag)
 	return 1;
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 0dbf468f6..cefa1c974 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -557,6 +557,14 @@
 >Hip hip hooray
 >Hip hip hooray
 
+  (setopt nonomatch
+  repeat 2*2 print yeah)
+0:Tokens in repeat argument
+>yeah
+>yeah
+>yeah
+>yeah
+
   case bravo {
     (alpha) print schmalpha
 	    ;;



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