Skip to content

Terminal integration error: syntax error in bash due to double curly braces #6224

@blackgirlbytes

Description

@blackgirlbytes

Bug Description

Users running eval "$(goose term init bash)" in their ~/.bashrc encounter a syntax error:

$ source .bashrc
-bash: eval: line 29: syntax error near unexpected token `{{'
-bash: eval: line 29: `goose_preexec() {{'

Root Cause

In crates/goose-cli/src/commands/term.rs, the bash script template uses {{ and }} which is Rust's format string escape syntax for literal braces. However, the code uses .replace() for string substitution instead of format!(), so the double braces are output literally instead of being converted to single braces.

For example:

goose_preexec() {{
    ...
}}

Outputs goose_preexec() {{ instead of goose_preexec() {.

Proposed Fix

Change {{ to { and }} to } in the BASH_CONFIG template since .replace() is used instead of format!().

Environment

  • goose version: 1.18.0
  • Shell: bash

Steps to Reproduce

  1. Add eval "$(goose term init bash)" to ~/.bashrc
  2. Run source ~/.bashrc
  3. Observe syntax error

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedGreat issue for non-Block contributorsp1Priority 1 - High (supports roadmap)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions