#!/bin/bash if [[ -z $1 ]]; then cat<&1 |grep "^error:"|awk '{print $5}'` if [ "$file" == "$prev" ] then break fi getsha $file done #8 - try and checkout files. It's not perfect, but you might get lucky for line in `git ls-files` do git checkout $line done