Steps to reproduce
Function Get-SomeData {
Clear-Host
$somedata="somedata"
return $somedata
}
$myData = Get-SomeData
$myData[0] # will clear the screen
$myData[1] # "somedata"
$myData.Count # will be 2
Expected behavior
Function should return a single value ("somedata")
Actual behavior
Function returns an array with the Clear-Host command as the first object
Environment data
Verified in:
| Name |
Value |
| PSVersion |
6.2.0 |
| PSEdition |
Core |
| GitCommitId |
6.2.0 |
| OS |
Linux 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 |
| Platform |
Unix |
| PSCompatibleVersions |
1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.2.0 |
| PSRemotingProtocolVersion |
2.3 |
| SerializationVersion |
1.1.0.1 |
| WSManStackVersion |
3.0 |
Steps to reproduce
Expected behavior
Actual behavior
Environment data
Verified in: