Backport support for ${$var} indirection from ksh93v- #931
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds the
${$var}feature from ksh93v-. It allows for indirect expansion of$var, such that ifvaris set to 'foo',${$var}expands to${foo}. Example:src/cmd/ksh93/sh.1,
src/cmd/ksh93/sh/lex.c,
src/cmd/ksh93/sh/macro.c:
M_BRACEala${@var}. This fixes a ksh93v- bug that could cause${$bar:0:1}to produce the string '00:1}' whenbaris not set.nv_openand simply set np to NULL.strtol.src/cmd/ksh93/tests/variables.sh:
${$var}now being valid syntax. The test now tries${$$}, which is invalid syntax in all ksh93 releases.${$var}indirect expansion (some are backports and some are new).This patch was stalled for a comically long time because the ksh93v- code had bugs that needed squashing (I've been using various iterations of it since 2021). In any case, this'll be my first 2026 submission to add to the pile of pull requests (I have many more patches, of course).