Ticket #39372

shell option for local 'for' loop iteration variable

Open Date: 2019-07-07 09:46 Last Update: 2019-07-09 21:46

Reporter:
Owner:
Status:
Closed
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
1
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

Would you be willing to implement a shell option such as forlocal which, when turned off, would disable the creation of a function-local variable by executing a for loop?

yash is the only shell that makes for loop iteration variables local, so it's a considerable incompatibility with scripts written for other shells. I'd like to be able to disable this behaviour without enabling the full posixlycorrect mode, which limits yash in many ways.

Please consider the attached patch, which implements and tests a forlocal option, and documents it in the English versions of the documentation files. I apologise that I'm not able to patch the Japanese language documentation.

Ticket History (3/5 Histories)

2019-07-07 09:46 Updated by: mcdutchie
  • New Ticket "shell option for local 'for' loop iteration variable" created
2019-07-07 09:49 Updated by: mcdutchie
  • Details Updated
2019-07-07 21:14 Updated by: magicant
Comment

Thanks for the suggestion of the new option! Your patch will be included in the next release.

2019-07-09 21:46 Updated by: magicant
  • Status Update from Open to Closed
  • Resolution Update from None to Fixed
Comment

Patch applied in r3993 with follow-ups r3994, r3995, r3996 and r3997

Attachment File List

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login