Skip to content

Instantly share code, notes, and snippets.

@jeevan-vj
Created February 13, 2018 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeevan-vj/cb4799c0eac7d98bdc48058d2f089ff1 to your computer and use it in GitHub Desktop.
Save jeevan-vj/cb4799c0eac7d98bdc48058d2f089ff1 to your computer and use it in GitHub Desktop.
array element exists in another array checking in powershell
$requiredFruit= @("apple","pear","nectarine","grape")
$someFruit= @("apple","banana","pear","nectarine","orange","grape")
$moreFruit= @("apple","banana","nectarine","grape")
-not @($requiredFruit| where {$someFruit -notcontains $_}).Count
-not @($requiredFruit| where {$moreFruit -notcontains $_}).Count
-not @($requiredFruit| where {$moreFruit -notcontains $_}| select -first 1).Count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment