Changeset 22a2ffd in lab.git for TipAndDoc/.bin
- Timestamp:
- Oct 4, 2012 6:47:28 PM (12 years ago)
- Branches:
- master, trunk
- Children:
- 1be8507
- Parents:
- 5eea6d8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TipAndDoc/.bin/cmpdir
r5eea6d8 r22a2ffd 4 4 echo "Usage: $0 directory1 directory2" 5 5 exit 1 6 fi 7 if [ $# -eq 3 ]; then 8 [ -d "$1/$3" ] && [ -d "$2/$3" ] && 9 exit 10 [ ! -e "$1/$3" ] && [ ! -e "$2/$3" ] && 11 echo "$0: something wrong abount '$3'" >&2 && exit 12 [ -e "$1/$3" ] && [ ! -e "$2/$3" ] && 13 echo "Only in '$1': '$3'" >&2 && exit 14 [ ! -e "$1/$3" ] && [ -e "$2/$3" ] && 15 echo "Only in '$2': '$3'" >&2 && exit 16 [ -f "$1/$3" ] && [ -d "$2/$3" ] && 17 echo "'$1' is a regular file but '$2' is a directory" >&2 && exit 18 [ -d "$1/$3" ] && [ -f "$2/$3" ] && 19 echo "'$1' is a directory but '$2' is a regular file" >&2 && exit 20 21 cmp -s "$1/$3" "$2/$3" || echo "$1/$3" "$2/$3" are differ >&2 22 exit 6 23 fi 7 24 if [ -d "$1" -a -d "$2" ]; then … … 15 32 wc=$PWD 16 33 cd "$1" 17 find ./-print0 >> "$tmp"34 find -print0 >> "$tmp" 18 35 cd $wc 19 36 20 37 cd "$2" 21 find ./-print0 >> "$tmp"38 find -print0 >> "$tmp" 22 39 cd $wc 23 40 24 41 sort -z "$tmp" | uniq -z > "$list" 25 42 26 comppath () {27 [ ! -e "$1/$3" ] && [ ! -e "$2/$3" ] &&28 (echo "$0: something wrong abount '$3'" >&2; return)29 [ -e "$1/$3" ] && [ ! -e "$2/$3" ] &&30 (echo "Only in '$1': '$3'" >&2; return)31 [ ! -e "$1/$3" ] && [ -e "$2/$3" ] &&32 (echo "Only in '$2': '$3'" >&2; return)33 }34 43 35 xargs -a "$list" -0 -n 1 -I entry cmp "$1/entry" "$2/entry"44 xargs -a "$list" -0 -n 1 -I entry $0 "$1" "$2" "entry"
Note: See TracChangeset
for help on using the changeset viewer.