PowerShell
https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/ps_black_64.svg?sanitize=true#.svg
https://github.com/PowerShell/PowerShell
PowerShellの$Profile
UNIXシェルと比べた良さ・悪さ
.NETのライブラリがネイティブに扱える
JSONやCSVのパーサーが標準で付いてくる
ややこしさ
Where-Objectの後の式に書くクオートしてない文字列はプロパティ名か文字列リテラルか
ネイティブ vs Cmdlet
パイプライン
単一オブジェクトと長さ1の配列に収まったオブジェクトの区別は?
code:sample.ps1
$array = @(Get-Date)
$array.Length # 1
$array | %{$_.Length} # 1
$array | %{$_.Year} # 2019
$date = Get-Date
$date.Length # 1
暗黙の型変換…
シェルのパイプともパイプライン演算子とも違うセマンティクス
バイナリが扱えない
Don’t parse the pipeline as text when it is directed from an EXE to another EXE or file. Keep the bytes as-is. · Issue #1908 · PowerShell/PowerShell
$env:path
UNIXでいうところの$PATH
;で区切る
PS> $env:path -split ';'
環境変数を$env:HOGEの記法で取得するのはPSDriveという機能で実現されている
$env:HOGEはcat env:HOGEと同じ意味
dir env:とかcd env:とかできる