[PATCH] [BUG] ${#10}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

dash have bug for ${#10} and etc: ignores 0... in name (without errors :)

$ foo() { echo "length 10-th arg '${10}' is ${#10}"; }
$ foo a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11
length 10-th arg 'a10' is 2

But need:
length 10-th arg 'a10' is 3


Micro patch attached


--w
vodz
--- parser.c~	2021-02-04 00:51:34.000000000 +0400
+++ parser.c	2021-02-05 12:42:43.616635640 +0400
@@ -1274,7 +1274,7 @@
 			do {
 				STPUTC(c, out);
 				c = pgetc_eatbnl();
-			} while (!subtype && is_digit(c));
+			} while ((!subtype || subtype == VSLENGTH) && is_digit(c));
 		} else if (c != '}') {
 			int cc = c;
 

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux