fixes to LINENO, read -n, command substitution and backslash-escaped newlines

This commit is contained in:
Chet Ramey
2021-12-20 20:03:26 -05:00
parent 5f2dd5ff95
commit b2b78a6348
16 changed files with 895 additions and 1185 deletions
+6 -2
View File
@@ -1149,6 +1149,7 @@ expr_streval (tok, e, lvalue)
#if defined (ARRAY_VARS)
arrayind_t ind;
int tflag, aflag;
array_eltstate_t es;
#endif
/*itrace("expr_streval: %s: noeval = %d expanded=%d", tok, noeval, already_expanded);*/
@@ -1203,13 +1204,16 @@ expr_streval (tok, e, lvalue)
}
#if defined (ARRAY_VARS)
ind = -1;
init_eltstate (&es);
es.ind = -1;
/* If the second argument to get_array_value doesn't include AV_ALLOWALL,
we don't allow references like array[@]. In this case, get_array_value
is just like get_variable_value in that it does not return newly-allocated
memory or quote the results. AFLAG is set above and is either AV_NOEXPAND
or 0. */
value = (e == ']') ? get_array_value (tok, aflag, (int *)NULL, &ind) : get_variable_value (v);
value = (e == ']') ? get_array_value (tok, aflag, &es) : get_variable_value (v);
ind = es.ind;
flush_eltstate (&es);
#else
value = get_variable_value (v);
#endif