check.sh 732 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # Copyright (C) 2014 Michał Masłowski <mtjm@mtjm.eu>
  3. #
  4. # Copying and distribution of this file, with or without modification,
  5. # are permitted in any medium without royalty provided the copyright
  6. # notice and this notice are preserved. This file is offered as-is,
  7. # without any warranty.
  8. # Verify the blacklist entries are correctly formatted.
  9. bad_entries="$(egrep -v '^[^:]*:[^:]*:(sv|debian|parabola|fsf|fedora)?:[^:]*:.*$' *.txt)"
  10. if [[ ! -z "$bad_entries" ]]; then
  11. printf "Incorrectly formatted entries:\n\n%s\n" "$bad_entries" >&2
  12. exit 1
  13. fi
  14. unsourced="$(egrep '^[^:]*:[^:]*::[^:]*:.*$' *.txt)"
  15. if [[ ! -z "$unsourced" ]]; then
  16. printf "[citation needed]:\n\n%s\n" "$unsourced" >&2
  17. exit 1
  18. fi