#!/bin/bash
# Original read-only chore.
# Provide exactly one owned directory argument, with ./ or an absolute path.
set -o pipefail
if [ "$#" -ne 1 ]; then
  printf '%s\n' 'Usage: bash list-notes.sh OWNED-DIRECTORY' >&2
  exit 2
fi
case "$1" in
  /*|./*) ;;
  *) printf '%s\n' 'Use an absolute path or a path beginning ./.' >&2; exit 2 ;;
esac
if [ ! -d "$1" ]; then
  printf '%s\n' 'Directory not found.' >&2
  exit 2
fi
find "$1" -type f -name '*.txt' -print | LC_ALL=C sort
