-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example reproducers: $ typeset foo+=bar -ksh: typeset: foo+: invalid variable name $ export foo+=bar -ksh: export: foo+: is not an identifier Expected result: 'bar' is appended to the value of foo and (in the 'export' case) then exported. This works on mksh and bash. Oddly enough, the following does work: $ unset foo $ foo[23]=bar $ typeset foo[23]+=baz $ typeset -p foo typeset -x -a foo=([23]=barbaz) The fact that it works *with* an array subscript strongly suggests that it is supposed to work without one. Indeed, testing historical ksh versions shows that this used to work but stopped working in version 93q+ 2005-05-22. The simple() function in parse.c, where it isolates a variable name from the rest of the assignment, has explicit code for recognising array subscripts preceding both '=' and '+='. But the same is simply not implemented for an assignment with a simple variable name. src/cmd/ksh93/sh/parse.c: simple(): - Add that missing implementation: decrease 'last' (pointer to the character following the last character of the variable name) if '+' is found before '='.
- Loading branch information
Showing
4 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters