Bash Toolbelt

Reading time ~1 minute

Bash Toolbelt

Note: Work in progress.

Misc Helpers

function requireField () {
  if [ $(printf "$1" | wc --bytes) -lt 1 ]; then
    printf >&2 "${red}${2}\n\n\n${reset}"
  fi
}

# Usage: 
requireField     $PASSWORD   "ERROR: PASSWORD is required environment var."
# 2 Parameter:   ^Variable^   ^Err Message^

image