+ if (( ${#to_remove[@]} >= 1 )); then
+ if type -P trash-put >/dev/null; then
+ if [[ $LNF_VERBOSE == true ]]; then
+ echo "lnf: trash-put -- ${to_remove[*]}"
+ fi
+ trash-put -- "${to_remove[@]}" || ret=$?
+ # 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 "$0: using rm -rf to overcome cross filesystem trash-put limitation"
+ rm -rf -- "${to_remove[@]}"
+ elif [[ $ret == 74 ]]; then
+ echo "$0: 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 [[ $LNF_VERBOSE == true ]]; then
+ echo "lnf: rm -rf -- ${to_remove[*]}"
+ fi
+ rm -rf -- "${to_remove[@]}"
+ fi
+ fi
+
+ $reset_extglob && shopt -u extglob
+
+ if $mkdir; then
+ if ! mkdir -p "$(dirname "$2")"; then
+ echo "lnf error: failed to make directory $(dirname "$2")"
+ return 1
+ fi
+ fi
+
+ ln -s $nodir -- "$@"