#!/bin/bash # Briefly describes the current working directory. # # Emits a short markdown fragment intended to sit under an h3 or smaller. # Always has something to say (cwd always exists), so it never goes silent. set -euo pipefail cwd="${PWD}" # Count entries (depth 1), separating dirs and files, ignoring dotfiles. # We use `find` rather than globbing to avoid surprises with empty dirs. n_dirs=$(find "$cwd" -mindepth 1 -maxdepth 1 -type d -not -name '.*' | wc -l) n_files=$(find "$cwd" -mindepth 1 -maxdepth 1 -type f -not -name '.*' | wc -l) n_hidden=$(find "$cwd" -mindepth 1 -maxdepth 1 -name '.*' | wc -l) echo "- path: \`${cwd}\`" echo "- contents: ${n_dirs} dirs, ${n_files} files, ${n_hidden} hidden entries (depth 1)."