Repository navigation
fix(parser): {arr[i]} is an fd variable in every redirect position - #2617
Merged
Merged
Conversation
`exec {A[1]}> file` parsed as a command named `{A[1]}` and failed with
`command not found`. The name lexes as several literal parts, because `[`
opens a glob bracket, and the fd-variable check only looked at a word
made of one part. Follow-up to #2605, which covered the close form.
Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 5204c04 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 12:35 AM |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Requested by Михайло · project thread
What changed
{arr[i]}is recognised as a redirect's fd variable wherever one may appear,not only in the close form:
exec {A[1]}> fileandexec {A[1]}>&-both work,and a subscript may be a variable (
{A[i]}).Why
Follow-up to #2605. That PR allowed brackets in the name but the check still
required the word to be a single literal part, and
{A[1]}lexes as several —[opens a glob bracket. So the redirect parsed as a command:Before / After
hibash: {A[1]}: command not foundhiA brace word that is not an fd variable is still a command:
{A-1}> o.txtreports
command not foundin both shells.Risk
Low and parser-local. The name is now read from the word's literal parts
joined; a word with any non-literal part (an expansion, a substitution) yields
nothing and is left alone, so
${x}> fileand$(cmd)> fileparse as before.Checklist
cargo test -p bashkit --lib(2920 passed)cargo test -p bashkit --test integration(1372 passed)bash_comparisondifferential tests against real bashcargo clippy -p bashkit --all-targets -- -D warningscargo fmt --all --checkcargo test -p bashkit-cli(56 passed)just check-okflog.md)https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code