Tíquete #39372

shell option for local 'for' loop iteration variable

: 2019-07-07 09:46 Última Atualização: 2019-07-09 21:46

Relator:
Dono:
Estado:
Fechado
Componente:
Marcos:
(Nenhum)
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Fixed
Arquivo:
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
Comentário

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
  • Resolução Update from Nenhum to Fixed
  • Estado Update from Aberto to Fechado
Comentário

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

Attachment File List

Editar

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