#!/bin/sh diff_recursive(){ local a="$1" local b="$2" local f1 if [ -d "$a" ]; then if [ -d "$b" ]; then ls "$a" | while read f1; do if ! [ -e "$b/$f1" ]; then echo "there is $a/$f1 but no $b/$f1" else diff_recursive "$a/$f1" "$b/$f1" fi done else echo "$a is a directory but $b is not" fi elif [ -L "$a" ]; then if ! [ -L "$b" ]; then echo "$a is a link buf $b is not" fi elif [ -f "$a" ]; then if [ -f "$b" ]; then if [ "$(file -b "$a"|head -c 3)" = ELF -a \ "$(file -b "$b"|head -c 3)" = ELF -o \ "$(file -b "$a")" = "current ar archive" -a \ "$(file -b "$b")" = "current ar archive" ] then if ! objdump -d "$a" | tail -n +3 | ( exec 3<&0; (objdump -d "$b" | tail -n +3) | cmp -s /dev/fd/0 /dev/fd/4 4<&3 ) ; then echo "objdiff in $a and $b" fi else if ! cmp -s "$a" "$b"; then echo "diff in $a and $b" fi fi else echo "$a is a normal file but $b is not" fi else echo "$a is not supported type" fi } diff_recursive $1 $2