Boilerplate


Sometimes the hardest part of any task is writing the first line. For my own convenience, here is some blocks of code I find myself needing now and then, but not enough to have them memorized.

Bash / Shell scripts

#!/bin/bash
set -euo pipefail
set -o posix

Oracle SQL*Plus

WHENEVER SQLERROR EXIT SQL.SQLCODE

PowerShell

#Requires -Version 7
param(
    [ValidateNotNullOrEmpty()]
    [String]$Param = 'default',

    [Switch]$SwitchParam
)

Set-StrictMode -Version 3.0
$ErrorActionPreference = 'Stop'