# shellcheck disable=SC2086,SC2048
# usage: trim_all "   example   string    "
trim_all() {
  # disable globbing to make the word-splitting below safe
  set -f
  # set the argument list to the word-splitted string
  # this removes all leading/trailing white-space and reduces
  # all instances of multiple spaces to a single ("  " -> " ")
  set -- $*
  # print the argument list as a string
  printf '%s\n' "$*"
  # re-enable globbing
  set +f
}
