Loop Over Files in a Directory
BashIterate over matched files with a glob — safe with nullglob set.
#!/usr/bin/env bash
set -euo pipefail
shopt -s nullglob
for f in *.log; do
printf 'processing %s\n' "$f"
done
Iterate over matched files with a glob — safe with nullglob set.
#!/usr/bin/env bash
set -euo pipefail
shopt -s nullglob
for f in *.log; do
printf 'processing %s\n' "$f"
done