rm 803 Bytes
Newer Older
1 2 3 4 5 6 7
#!/bin/bash
#########################################################
# 							#
# This is BashStyle-NG					#
#							#
# Licensed under GNU GENERAL PUBLIC LICENSE v3    	#
#							#
8
# Copyright 2007 - 2011 Christopher Bratusek		#
9 10 11
#							#
#########################################################

12 13 14 15 16 17
if [[ $WANT_DIRINFO_FLAGS == "true" ]]; then

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

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

30 31 32 33
	unset RMO

else	$RM_CMD "$@"
fi