#!/bin/bash cat_failed () { if ! test -d "$1"; then echo ERROR dumping the failing test logs. echo echo Give valid directory to start crawling. echo Example ./cat_failed.sh dir/ echo return 1 fi for trs in $(find "${1}" -name "*.trs") ; do if head -q -n1 < ${trs} | grep -q FAIL; then filename_log=$(echo ${trs}|sed -e 's/trs$/log/') echo echo "== DUMPING LOGS ==" echo cat ${filename_log} fi done return 0 }