Powershell pitfalls

后端 未结 21 1376
梦谈多话
梦谈多话 2020-12-23 01:44

What Powershell pitfalls you have fall into? :-)

Mine are:

# -----------------------------------
function foo()
{
    @(\"text\")
}

# Expected 1, a         


        
21条回答
  •  借酒劲吻你
    2020-12-23 02:16

    Another one:

    $x = 2
    $y = 3
    $a,$b = $x,$y*5 
    

    because of operators precedence there is not 25 in $b; the command is the same as ($x,$y)*5 the correct version is

    $a,$b = $x,($y*5)
    

提交回复
热议问题