--- revdep-rebuild-rewrite_pre7~ 2007-09-30 00:42:50.000000000 +0100 +++ revdep-rebuild-rewrite_pre7 2007-09-30 01:04:13.000000000 +0100 @@ -100,30 +100,25 @@ # of various versions of -perm /+ blah blah and hacks find() { hash find || { die 1 'find not found!'; } - # We can be pretty sure "$0" should be executable. - if [[ $(command find "$0" -executable 2> /dev/null) ]]; then + # We can be pretty sure find should be executable. + if [[ $(command find "$(type -P find)" -executable 2> /dev/null) ]]; then unset -f find # We can just use the command find - elif [[ $(command find "$0" -perm /u+x 2> /dev/null) ]]; then + elif [[ $(command find "$(type -P find)" -perm /u+x 2> /dev/null) ]]; then find() { a=(${@//-executable/-perm \/u+x}) a=(${a[@]//-writable/-perm \/u+w}) a=(${a[@]//-readable/-perm \/r+w}) command find "${a[@]}" } - elif [[ $(command find "$0" -perm +u+x 2> /dev/null) ]]; then + elif [[ $(command find "$(type -P find)" -perm +u+x 2> /dev/null) ]]; then find() { a=(${@//-executable/-perm +u+x}) a=(${a[@]//-writable/-perm +u+w}) a=(${a[@]//-readable/-perm +r+w}) command find "${a[@]}" } - else # Last resort - find() { - a=(${@//-executable/-exec test -x '{}' \;}) - a=(${a[@]//-writable/-exec test -w '{}' \;}) - a=(${a[@]//-readable/-exec test -r '{}' \;}) - command find "${a[@]}" - } + else + die 1 "don't know how to search for permissions with find" fi find "$@" }