jeudi 6 août 2015

Something is wrong with my if-statement?

a confusing question.

$msg = 'http://www.bla.de'

$match = $msg -match '^(.*)".+?":(\S+)\s*(.*)$'
$match_linkalone = $msg -match '^(.*)(http://|https://)(\S+)\s*(.*)$'

$match
> False
$match_linkalone
> True

if($match -eq "True" -and $match_linkalone -eq "False")
    {echo 'if';}
        elseif($match_linkalone -eq "True" -and $match -eq "False")
            {echo 'elif';}
                else
                    {echo 'else';}
> else

But if I do it like that

$match = 'False'
$match_linkalone = 'True'

if($match -eq "True" -and $match_linkalone -eq "False")
    {echo 'if';}
        elseif($match_linkalone -eq "True" -and $match -eq "False")
            {echo 'elif';}
                else
                    {echo 'else';}
> elif

I really don't understand this...

It looks like your post is mostly code; please add some more details. --> I think it's self-explaining.

I'm working on PowerShell

Aucun commentaire:

Enregistrer un commentaire