PowerShell trick

Do you know how to change the script below to make it true?

((‘first’,’second’))[0][1] -eq ((‘first’,’second’),(‘first’,’second’))[0][1]

I want to get ‘second‘ from the left operand ((‘first’,’second’))[0][1]

(,(‘first’,’second’))[0][1] comma is not a solution as it will not work for (,(‘first’,’second’),(‘first’,’second’))[0][1]

(,(‘first’,’second’))[0][1] -eq (,(‘first’,’second’),(‘first’,’second’))[0][1] will still return False

Advertisements

2 thoughts on “PowerShell trick

  1. ditch [0] on the left, powershell collapses unnecessary brackets
    ((‘1st’,’2nd’))[0][1] -eq ((‘1st’,’2nd’),(‘3rd’,’4th’))[0][1] ==> False

    ((‘1st’,’2nd’))[1] -eq ((‘1st’,’2nd’),(‘3rd’,’4th’))[0][1] ==> True

  2. Hi milkekacz,
    Thank you for you reply!
    I’ve asked this question more than 3 years ago. Right now, I don’t even understand why I did asked it 🙂
    But, anyway, thank you for your attention.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s