Featured image of post [PowerShell] 59. 매개변수 검증(Validate 속성군)

[PowerShell] 59. 매개변수 검증(Validate 속성군)

PowerShell ValidateSet/ValidateRange/ValidatePattern/ValidateScript 같은 매개변수 검증 속성으로 함수 본문에 도달하기 전 입력값을 걸러내는 법과 Mandatory·AllowNull 등 필수성 관련 속성을 정리한 챕터다.

Featured image of post [PowerShell] 60. 매개변수 스플래팅(Splatting)

[PowerShell] 60. 매개변수 스플래팅(Splatting)

PowerShell 스플래팅(@ 기호로 해시테이블·배열을 매개변수 묶음으로 넘기는 문법)과 $PSBoundParameters로 함수 인자를 다른 함수에 그대로 전달하는 법, PowerShell 7.1의 명시적 매개변수 우선순위를 정리한 챕터다.

Featured image of post [PowerShell] 63. 스크립트 블록과 클로저

[PowerShell] 63. 스크립트 블록과 클로저

PowerShell 스크립트 블록 {} 리터럴이 System.Management.Automation.ScriptBlock 객체인 원리와 호출 연산자(&)로 실행하는 법, GetNewClosure()로 클로저를 만드는 법, 지연 바인딩(delay-bind) 스크립트 블록을 정리한 챕터다.

Featured image of post [PowerShell] 65. try/catch/finally — 예외 처리

[PowerShell] 65. try/catch/finally — 예외 처리

PowerShell try/catch/finally 문법과 종료 오류(terminating error)만 catch되는 원리, .NET 예외 타입별로 catch 블록을 나누는 법, $_ 자동 변수로 오류 정보를 꺼내는 법을 정리한 Part 7 시작 챕터다.

Featured image of post [PowerShell] 67. trap — 레거시 예외 처리

[PowerShell] 67. trap — 레거시 예외 처리

PowerShell trap 키워드로 스코프 전체의 종료 오류를 처리하는 법과 break/continue로 이후 실행 여부를 결정하는 법, try/catch가 표준이 된 오늘날 trap을 써야 할 때와 스코프 규칙의 차이를 정리한 챕터다.

Featured image of post [PowerShell] 68. Write-Verbose/Debug/Warning/Information

[PowerShell] 68. Write-Verbose/Debug/Warning/Information

PowerShell Write-Verbose/Write-Debug/Write-Warning/Write-Information이 각각 다른 출력 스트림에 쓰는 원리와 -Verbose/-Debug 공통 매개변수로 표시 여부를 켜는 법, 29장 Write-Host와의 차이를 정리한 챕터다.