How to test for $null array in PowerShell

前端 未结 6 987
感情败类
感情败类 2020-12-08 00:24

I\'m using an array variable in PowerShell 2.0. If it does not have a value, it will be $null, which I can test for successfully:

PS C:\\> [array]$foo =          


        
6条回答
  •  青春惊慌失措
    2020-12-08 00:56

    You can reorder the operands:

    $null -eq $foo
    

    Note that -eq in PowerShell is not an equivalence relation.

提交回复
热议问题