From c0a8574825e24a924a693c8b74941a65f25683ec Mon Sep 17 00:00:00 2001 From: Andrew Ryan Davis Date: Wed, 19 Aug 2020 23:23:53 -0700 Subject: [PATCH] Fixing typo and some other formatting Doubled input on 'pipeline' spaces between commented sections expand alias on where --- powershell.html.markdown | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/powershell.html.markdown b/powershell.html.markdown index 6a850028..da4dcd5c 100644 --- a/powershell.html.markdown +++ b/powershell.html.markdown @@ -29,6 +29,7 @@ Powershell as a Language: like so #> + #################################################### ## 1. Primitive Datatypes and Operators #################################################### @@ -191,6 +192,7 @@ $someVariable # => 5 # Ternary Operators exist in Powershell 7 and up 0 ? 'yes' : 'no' # => no + # The default array object in Powershell is an fixed length array $defaultArray = "thing","thing2","thing3" # you can add objects with '+=', but cannot remove objects @@ -282,8 +284,6 @@ $filledHash["one"] # => 1 # items maintain the order at which they are inserted into the dictionary. $filledHash.keys # => ["one", "two", "three"] - - # Get all values as an iterable with ".Values". $filledHash.values # => [1, 2, 3] @@ -303,7 +303,6 @@ $filledHash["four"] = 4 # $filledHash["four"] is set to 4, run again and it does $filledHash.Remove("one") # Removes the key "one" from filled dict - #################################################### ## 3. Control Flow and Iterables #################################################### @@ -403,7 +402,6 @@ $contents | Out-File "$env:HOMEDRIVE\file.txt" # writes to another file Get-Content "$env:HOMEDRIVE\file.csv" | ConvertTo-Json - #################################################### ## 4. Functions #################################################### @@ -484,7 +482,6 @@ Get-Command -module dbaTools Get-Help dbaTools -Full - #################################################### ## 6. Classes #################################################### @@ -538,7 +535,6 @@ True False Guitar Instrument #> - #################################################### ## 7. Advanced #################################################### @@ -558,13 +554,13 @@ Get-Process | Foreach-Object ProcessName | Group-Object # Useful pipeline examples are iteration and filtering 1..10 | ForEach-Object { "Loop number $PSITEM" } -1..10 | where {$PSITEM -gt 5} | Format-Table +1..10 | Where-Object { $PSITEM -gt 5 } | ConvertTo-Json # A noteable pitfall of the pipeline is it's performance when # compared with other options -# additionally, raw bytes are not passed through the piipeline +# Additionally, raw bytes are not passed through the pipeline # so passing an image causes some issues -# See more on that in the links at the bottom +# See more on that in the link at the bottom <# Asynchronous functions exist in the form of jobs