Skip to main content

Timeline for Appending to local array

Current License: CC BY-SA 4.0

4 events
when toggle format what by license comment
Jul 26, 2021 at 21:23 comment added ilkkachu I don't see how the subshell is necessary if the variable is made local... E.g. foo() { local foo+=bar; echo $foo; } prints bar just once, regardless of how many times it was called before. (Also, I have this awkward feeling that doing the assignment right in the local was problematic in some cases, but I can't remember why.)
Jul 26, 2021 at 13:48 vote accept Pietru
Jul 26, 2021 at 13:48 comment added Pietru Have figured out that I was transferring the contents of isufx to another array which was not defined as local. Thusly, the problem emerged.
Jul 26, 2021 at 13:33 history answered jesse_b CC BY-SA 4.0