"sed" command fails when the file path has $(dollar sign) in it #2584

Resolved 💬 2 comments Opened Aug 22, 2025 by hlthi Closed Dec 12, 2025

What version of Codex is running?

codex-cli 0.23.0

Which model were you using?

gpt-5-mini

What platform is your computer?

Darwin 25.0.0 arm64 arm

What steps can reproduce the bug?

Create a file whose name contains a $ character:

touch myfilename.$otherpartname.tsx

(Example dynamic route used in TanStack Router)
Try to process/read the file with a CLI command, for example:
Bash

sed -n '1,360p' myfilename.$otherpartname.tsx
````





### What is the expected behavior?

The command should read/process the file normally, with the $ treated as a literal part of the file name.

### What do you see instead?

The command fails or returns incorrect output. The $ is being interpreted by the shell as a variable reference, so the CLI cannot find or correctly read the file.

  └ ⌨️ sed -n '1,360p' src/routes/x.$y.tsx
    /opt/homebrew/Library/Homebrew/cmd/shellenv.sh: line 18: /bin/ps: Operation not permitted
    sed: src/routes/x..tsx: No such file or directory

### Additional information

In most shells, $ is a special character used for variable expansion.
The CLI likely needs to quote or escape file paths before executing commands to handle such filenames correctly.

Just escape !

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗