#!/usr/bin/env bash set -euo pipefail without_null=(empty/*.log) printf "without nullglob:\n" printf "count=%s\n" "${#without_null[@]}" printf "value=%s\n" "${without_null[0]}" shopt -s nullglob with_null=(empty/*.log) printf "with nullglob:\n" printf "count=%s\n" "${#with_null[@]}" shopt -s dotglob dot_matches=(reports/*.log) printf "with dotglob:\n" printf "%s\n" "${dot_matches[@]}" shopt -s globstar recursive_matches=(reports/**/*.log) printf "with globstar:\n" printf "%s\n" "${recursive_matches[@]}"