mark-as-watched.sh 361 B

12345678910111213
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. input="${1:-$PWD}"
  4. basename="${input##*/}"
  5. date="$(date +'%F')"
  6. watched_movies_file="${HOME}/Documents/movies-watched.txt"
  7. echo "${date} ${basename}" >> "$watched_movies_file"
  8. sort -u "$watched_movies_file" -o "$watched_movies_file"
  9. echo "Added file to a watched list"
  10. touch WATCHED FINISHED COMPLETED