"brian m. carlson" <sandals@xxxxxxxxxxxxxxxxxxxx> writes: > +convert_expected () { > + file="$1" && > + for i in one three_file master master2 one_tree three two two2 three2 > + do > + sed -e "s/$(test_oid --hash=sha1 "$i")/$(test_oid "$i")/g" \ > + "$file" >"$file.tmp" && > + mv "$file.tmp" "$file" > + done > +} Perhaps we can avoid rewriting the same file that many times, by feeding the mapping to a single invocation of sed? E.g. sedScript= for i in one three_file master master2 one_tree three two two2 three2 do i="s/$(test_oid --hash=sha1 $i/$(test_oid $i)/g" sedScript=$sedScript${sedScript:+;}$i" done && sed -e "$sedScript" "$file" >"$file.new" && mv "$file.new" "$file" If somebody's "sed" does not like multiple command concatenated with ";", we can take advantage of the fact that we are just replacing hexadecimal string without anything funny and go eval, e.g. sedCmd="sed" for i in one three_file master master2 one_tree three two two2 three2 do sedCmd="$sedCmd -e s/$(test_oid --hash=sha1 $i/$(test_oid $i)/g" done && eval "$sedCmd" "$file" >"$file.new" && mv "$file.new" "$file"