Found to be not a bug:

$ i=42; : ${var#${q[i=777]}}; echo $i; var=meow; : ${var#${q[i=777]}};
echo $i

must return 777 twice, because the pattern must always be expanded
before looking at $var.

$ i=42; : ${var+${q[i=777]}}; echo $i; var=meow; : ${var+${q[i=777]}};
echo $i

already behaves correctly (42 then 777).

** Changed in: mksh
       Status: Triaged => Invalid

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

Title:
  too eager expansion in substitution

Status in mksh:
  Invalid

Bug description:
  “If word is not needed, it shall not be expanded.” (POSIX)

  00:52 < izabera> i=42; : ${var#${q[i=777]}}; echo $i; var=meow; : 
${var#${q[i=777]}}; echo $i
  00:52 < izabera> prints 42 777 in bash and ksh93
  00:52 < izabera> and 777 777 in mkmsh

  The #/##/%/%% of course need to expand word first.

  Thanks to jilles for the heads-up.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1798397/+subscriptions

Reply via email to