#!/bin/sh # prints out logs that are in all directories if [ $# -lt 2 ]; then echo "usage: $0 dir1 dir2 [dir3...]" exit 1 fi here=$(pwd) dir1=$1 concat="$(echo $*)" plus="$(echo $* | sed -e 's/ /+/g')" of=$here/$plus.html echo "Logs that are in all of \"$concat\"" >$of echo "

Logs that are in all of \"$concat\"

" >>$of echo "" >>$of cd $here/$1 logs="$(echo *.log)" if [ "x$logs" = "x*.log" ]; then echo "No errors" >>$of else shift while [ $# -gt 0 ]; do num=0 newlogs="" cd $here/$1 for log in *.log; do if echo $logs | grep -Fwq $log; then newlogs="$newlogs $log" num=$(($num + 1)) fi done logs=$newlogs shift done if [ $num = 0 ]; then echo "No errors" >>$of else echo "" >>$of echo "" >>$of set $newlogs while [ $# -gt 0 ]; do echo -n "" >>$of shift done echo "
Log
" >>$of echo -n "" >>$of echo -n $(basename $1 .log) >>$of echo -n "" >>$of echo "

" >> $of echo "$num errors
" >> $of fi fi echo "
" >> $of echo "back to top" >> $of echo "" >>$of