#!/bin/bash
#########################################################
# 							#
# This is BashStyle-NG					#
#							#
# Licensed under GNU GENERAL PUBLIC LICENSE v3    	#
#							#
# Copyright 2007 - 2014 Christopher Bratusek		#
#							#
#########################################################

if [[ $1 == --help || $1 == -h ]]; then
	$RM_CMD --help
	exit 0
fi

for path in "$@"; do
    test "${path:0:1}" == - && RMO+="$path " && continue
    for try in "$path" "${path%/*}" "$(dirname ${path} 2>/dev/null)"; do
	test -e "$try"/.dirinfo || continue
	grep -q NoDelete "$try"/.dirinfo || continue
	echo "can not delete $path -- it's protected"
	continue 2
    done
    $RM_CMD $RM_OPTS $RMO "$path"
done

unset RMO
