Repository navigation
Closed as duplicate
Closed as duplicate
Copy link
Labels
Issue-BugIssue has been identified as a bug in the productResolution-DuplicateThe issue is a duplicate.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
When running the sed command with the -i.bk option (to specify a backup suffix), PowerShell on Linux fails to execute the command correctly. It appears that PowerShell's command-line parser splits the -i.bk argument into multiple tokens, treating .bk as a separate argument.
This causes sed to misinterpret the options and fail with an error such as:
> sed -i.bk 's/foo/bar/' file.txt
/usr/bin/sed: -e expression #1, char 1: unknown command: `.'Root Cause Hypothesis
PowerShell's command-line parser may be incorrectly splitting arguments that begin with a dash (-) and contain a dot (.), assuming the dot introduces a separate token. This behavior is inconsistent with standard shell parsing and breaks compatibility with many Unix-style tools.
Expected behavior
PowerShell should pass `-i.bk` as a single argument to the external command, preserving the intended behavior of `sed`.Actual behavior
PowerShell splits `-i.bk` into two tokens: `-i` and `.bk`, resulting in incorrect execution.
# This fails in PowerShell on Linux
sed -i.bk 's/foo/bar/' file.txt
# This works correctly in bash or other shells
bash -c "sed -i.bk 's/foo/bar/' file.txt"
### Result of `Trace-Command`
> Trace-Command -Name CommandDiscovery,ParameterBinding -Expression { sed -i.bk 's/foo/bar/' test.txt } -PSHost
DEBUG: 2025-11-15 01:29:56.1475 CommandDiscovery Information: 0 : Looking up command: sed
DEBUG: 2025-11-15 01:29:56.1478 CommandDiscovery Information: 0 : PATH: ...
DEBUG: 2025-11-15 01:29:56.1479 CommandDiscovery Information: 0 : Looking for sed in ...
(snip)
DEBUG: 2025-11-15 01:29:56.1672 CommandDiscovery Information: 0 : Command Found: path (/usr/bin/sed) is an application with name: sed
DEBUG: 2025-11-15 01:29:56.1674 ParameterBinding Information: 0 : BIND NAMED native application line args [/usr/bin/sed]
DEBUG: 2025-11-15 01:29:56.1675 ParameterBinding Information: 0 : BIND cmd line arg [-i] to position [0]
DEBUG: 2025-11-15 01:29:56.1675 ParameterBinding Information: 0 : BIND cmd line arg [.bk] to position [1]
DEBUG: 2025-11-15 01:29:56.1676 ParameterBinding Information: 0 : BIND cmd line arg [s/foo/bar/] to position [2]
DEBUG: 2025-11-15 01:29:56.1676 ParameterBinding Information: 0 : BIND cmd line arg [test.txt] to position [3]
DEBUG: 2025-11-15 01:29:56.1682 ParameterBinding Information: 0 : CALLING BeginProcessing
/usr/bin/sed: -e expression #1, char 1: unknown command: `.'Error details
Environment data
Name Value
---- -----
PSVersion 7.6.0-preview.5
PSEdition Core
GitCommitId 7.6.0-preview.5
OS Ubuntu 24.04.3 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productResolution-DuplicateThe issue is a duplicate.
Activity
mklement0 commentedon Nov 14, 2025
Yes, this is an unfortunate, long-standing known problem, along with several related ones:
teramako commentedon Nov 14, 2025
Thank you for linking to the known issue. 🙇
I believe it's the exact same problem. I'll patiently wait for it to be fixed .
SeeminglyScience commentedon Feb 5, 2026
Thanks for the report! Tracking in the referenced issue