- if type -P trash-put >/dev/null; then
- if $verbose; then
- echo "lnf: trash-put -- ${to_remove[*]}"
- fi
- if ! $dry_run; then
- trash-put -- "${to_remove[@]}" || ret=$?
- fi
- # trash-put will fail to trash a link that goes across filesystems (72),
- # and for empty files (74)
- # so revert to rm -rf in that case
- if [[ $ret == 72 ]]; then
- echo "lnf: using rm -rf to overcome cross filesystem trash-put limitation"
- rm -rf -- "${to_remove[@]}" || return $?
- elif [[ $ret == 74 ]]; then
- echo "lnf: using rm -rf to overcome empty file & hardlink trash-put limitation"
- rm -rf -- "${to_remove[@]}"
- elif [[ $ret && $ret != 0 ]]; then
- return $x
- fi
- else
- if $verbose; then
- echo "lnf: rm -rf -- ${to_remove[*]}"
- fi
- if ! $dry_run; then
- rm -rf -- "${to_remove[@]}"
- fi