8000 pwsh doesn't parse positional negative integer parameters correctly · Issue #11939 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content
pwsh doesn't parse positional negative integer parameters correctly #11939
@curegit

Description

@curegit

I found the pwsh command doesn't parse positional integer parameters as expected when they are negative. This doesn't happen if you use the powershell command in windows cmd.

Steps to reproduce

script.ps1 is as below.

Param([Int]$number)
Write-Host $number

Expected behavior

$ pwsh script.ps1 -1
-1

Actual behavior

$ pwsh script.ps1 -1
0

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.4
PSEdition                      Core
GitCommitId                    6.2.4
OS                             Darwin 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0