fyi, attached a small script which facilitates the inter-shell
comparison (might be augmented for further contexts in which $* and $@
get expanded, if necessary). the result looks like

+++++++++++++++++
$1=a, $2=b, IFS=,
+++++++++++++++++
command             ksh   mksh   bash   zsh
echo $*             a b   a b    a b    a b
echo "$*"           a,b   a,b    a,b    a,b
echo $@             a b   a b    a b    a b
echo "$@"           a b   a b    a b    a b
x=$*; echo "$x"     a,b   a,b    a,b    a,b
x="$*"; echo "$x"   a,b   a,b    a,b    a,b
x=$@; echo "$x"     a b   a b    a b    a,b
x="$@"; echo "$x"   a b   a b    a b    a,b
x=$*; echo $x       a b   a b    a b    a,b
x="$*"; echo $x     a b   a b    a b    a,b
x=$@; echo $x       a b   a b    a b    a,b
x="$@"; echo $x     a b   a b    a b    a,b
cat <<< $*          a,b   a,b    a,b    a,b
cat <<< "$*"        a,b   a,b    a,b    a,b
cat <<< $@          a b   a,b    a b    a,b
cat <<< "$@"        a b   a,b    a b    a,b

what it shows is, that bash manages to mimic ksh behaviour completely
here. mksh differs only in the handling of the here strings from
ksh/bash and only for $@. zsh does here strings like mksh and something
different from all other shells when printing unquoted variable
assignment.

since all these differences seem to concern details of interpreting the
standard and/or decisions whether to follow ksh or not, I think you are
in a better position (as the author of one of the shells) to contact the
other shells' maintainers than me. but if you think it makes sense, I
also could do that.

overall, I still neither do understand the differences between the
shells nor the differences between the different variants of
accessing/using $* and $@ completely...

but from a pragmatic point of view: if mksh would modify its here string
handling somewhat, ksh, mksh, bash would behave identical. and identical
behaviour of different shells I like ;).



** Attachment added: "compat"
   
https://bugs.launchpad.net/mksh/+bug/1857195/+attachment/5315544/+files/compat

-- 
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

Reply via email to