count() {
  # usage: count /path/to/dir/*
  #        count /path/to/dir/*/
  # [ "$#" -ne 0 ] \
  [ -e "$1" ] \
    && printf '%d\n' "$#" \
    || printf '%s\n' 0
}
count "$@"
