version 1.40.130 release
[feisty_meow.git] / scripts / rip_burn / checker_report.sh
1 #!/bin/bash
2
3 # checker_report: runs the checker utility against all files in a directory,
4 # in such a way that the file count can be very high without blowing its
5 # mind, and without any extra headers in the report.
6
7 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
8
9 dirname="$1"; shift
10 outfile="$1"; shift  # optional parm.
11
12 if [ -z "$dirname" ]; then
13   echo "This script requires one directory on which to make a checker report."
14   echo "Additionally, you can specify an output file as the second parameter."
15   exit 1
16 fi
17
18 if [ -z "$outfile" ]; then
19   outfile="$HOME/checker_report_$(hostname)_$(date_stringer).txt"
20 fi
21
22 if [ -f "$outfile" ]; then
23   rm "$outfile"
24 fi
25
26 temp_file_list="$(mktemp /tmp/file_list_temporary.XXXXXX)"
27
28 find "$dirname" -type f >"$temp_file_list"
29 while read input_text; do
30   checker -q -b "$input_text" 2>&1 >>"$outfile"
31 done <"$temp_file_list"
32
33 rm "$temp_file_list"
34