[Bug 1857195] Re: here string behaviour different in mksh and ksh93
Not a definite decision, but consider this: print -r -- "${x[@]}" - vs. - a="${x[@]}" In the first code, the elements of array x are expanded in list context, that is, each element as separate word, unset elements generating no words. In the second code, the elements are expanded in scalar context (because they are then assigned to a scalar), that is, the same as in: a="${x[*]}" First, one string is built from *all* array elements, IFS[0]-separated, then it is passed to the assignee. I think it’s not unusual to consider the argument of a here string scalar context. I built here stings in mksh to parallel here documents, where the separator is scalar, so this is by coïncidence, but I don’t see anything wrong with the mksh behaviour, upon a short two-minute reflection. -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1857195 Title: here string behaviour different in mksh and ksh93 Status in mksh: New Bug description: consider IFS=$'\n' x=(a "b c") cat <<< ${x[*]} cat <<< "${x[*]}" cat <<< ${x[@]} cat <<< "${x[@]}" executing this in mksh (or zsh, incidentally) yields the output a b c a b c a b c a b c (i.e. identical output, always inserting first IFS char between elements, for all variants of accessing all elements of the array) while ksh93 (or bash, for that matter) yields a b c a b c a b c a b c (i.e. `*' behaves different from `@' but double quoting is ineffectual). I am not sure whether this is a bug (either in ksh93 or mksh) but wanted to report this inconsistency and to ask for clarification. what I _would_ have expected to start with is, that the above "here string" commands would yield the same output as print ${x[*]} print "${x[*]}" print ${x[@]} print "${x[@]}" which is neither true for ksh93 nor for mksh. is this all good and well and I am only overlooking something obvious? To manage notifications about this bug go to: https://bugs.launchpad.net/mksh/+bug/1857195/+subscriptions
[Bug 1857195] [NEW] here string behaviour different in mksh and ksh93
Public bug reported: consider IFS=$'\n' x=(a "b c") cat <<< ${x[*]} cat <<< "${x[*]}" cat <<< ${x[@]} cat <<< "${x[@]}" executing this in mksh (or zsh, incidentally) yields the output a b c a b c a b c a b c (i.e. identical output, always inserting first IFS char between elements, for all variants of accessing all elements of the array) while ksh93 (or bash, for that matter) yields a b c a b c a b c a b c (i.e. `*' behaves different from `@' but double quoting is ineffectual). I am not sure whether this is a bug (either in ksh93 or mksh) but wanted to report this inconsistency and to ask for clarification. what I _would_ have expected to start with is, that the above "here string" commands would yield the same output as print ${x[*]} print "${x[*]}" print ${x[@]} print "${x[@]}" which is neither true for ksh93 nor for mksh. is this all good and well and I am only overlooking something obvious? ** Affects: mksh Importance: Undecided Status: New -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1857195 Title: here string behaviour different in mksh and ksh93 Status in mksh: New Bug description: consider IFS=$'\n' x=(a "b c") cat <<< ${x[*]} cat <<< "${x[*]}" cat <<< ${x[@]} cat <<< "${x[@]}" executing this in mksh (or zsh, incidentally) yields the output a b c a b c a b c a b c (i.e. identical output, always inserting first IFS char between elements, for all variants of accessing all elements of the array) while ksh93 (or bash, for that matter) yields a b c a b c a b c a b c (i.e. `*' behaves different from `@' but double quoting is ineffectual). I am not sure whether this is a bug (either in ksh93 or mksh) but wanted to report this inconsistency and to ask for clarification. what I _would_ have expected to start with is, that the above "here string" commands would yield the same output as print ${x[*]} print "${x[*]}" print ${x[@]} print "${x[@]}" which is neither true for ksh93 nor for mksh. is this all good and well and I am only overlooking something obvious? To manage notifications about this bug go to: https://bugs.launchpad.net/mksh/+bug/1857195/+subscriptions