dotkb

    Environment variable defaults

    (updated: )
    #!/bin/bash
    set -euo pipefail
    
    : "${GREETING:=Hello}"
    : "${NAME:=user}"
    
    echo "${GREETING} ${NAME}"
    

    Sources

    https://emmer.dev/blog/bash-environment-variable-defaults/