bug-bash
[Top][All Lists]
Advanced

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

Arithmetic expression: recursive VAR evaluation suppresses desired VAR a


From: Steffen Nurpmeso
Subject: Arithmetic expression: recursive VAR evaluation suppresses desired VAR assignment
Date: Thu, 11 Aug 2022 02:00:20 +0200
User-agent: s-nail v14.9.24-284-ga4878ec567

Hello.

Given this file

  # make this work with (ba)sh \
  command -v shopt && shopt -s expand_aliases;\
  alias p=printf;alias e=echo;alias s=export
  s I1=I1=10 I2=5 I3=I2+=1;p "<$((I1=0?I1:I3))>";e "<$I1><$I2><$I3>"
  s I1=I1=10 I2=5 I3=I2+=1;p "<$((I1=1?I1:I3))>";e "<$I1><$I2><$I3>"

i now see (after having fixed yet another bug in my Dijkstra
implementation that was most heavily inspired by the one from
busybox, so that i wanted to donate it back with correct ?: etc):

  #?0|kent:tmp$ /x/src/busybox.git/busybox sh xxx.sh
  <6><0><6><I2+=1>
  <1><1><5><I2+=1>
  #?0|kent:tmp$ bash xxx.sh
  shopt
  <6><6><6><I2+=1>
  <10><10><5><I2+=1>

I think the busybox variant is correct.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]