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
Actual behavior
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
I found the
pwshcommand doesn't parse positional integer parameters as expected when they are negative. This doesn't happen if you use thepowershellcommand in windows cmd.Steps to reproduce
script.ps1is as below.Expected behavior
Actual behavior
Environment data