-eq Operator Returns Nothing if Left Side is a Byte Array

I want to compare two byte arrays and seem to have run into a bug. Not sure why. I will probably switch to Compare-Object but I wanted to bounce this off the community.

I vaguely seem to recall being warned that in some cases the -eq operator can malfunction and serve as an assignment operator rather than a comparison operator, setting variables to $null when it was only supposed to be comparing them to $null.

$Side1 = [Byte[]]@('0xef','0xbb','0xbf') $Side2 = $Side1 $Side1 -eq $Side2 $Side1 -eq 1 1 -eq $Side1 

Expected Output:

True False False 

Actual Output (only the last line returns anything):


submitted by /u/OathOfFeanor
[link] [comments]

Leave a Reply