From cf9ff025082b04679a894650f2c511c509971056 Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Mon, 9 Dec 2002 02:22:50 +0000 Subject: Correctly handle files with IFS characters (spaces) in their names when cleaning up temporary files. Submitted by: Mike Makonnen Approved by: re --- adduser/rmuser.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'adduser/rmuser.sh') diff --git a/adduser/rmuser.sh b/adduser/rmuser.sh index afc978c..67c9a83 100644 --- a/adduser/rmuser.sh +++ b/adduser/rmuser.sh @@ -33,7 +33,7 @@ ATJOBDIR="/var/at/jobs" CRONJOBDIR="/var/cron/tabs" MAILSPOOL="/var/mail" SIGKILL="-KILL" -TEMPDIRS="/tmp /var/tmp /var/tmp/vi.recover" +TEMPDIRS="/tmp /var/tmp" THISCMD=`/usr/bin/basename $0` # err msg @@ -57,12 +57,8 @@ rm_files() { continue fi echo -n "Removing files owned by ($login) in $_dir:" - filecount=0 - _ownedfiles=`find 2>/dev/null $_dir -maxdepth 1 -user $login -print` - for _file in $_ownedfiles ; do - rm -fd $_file - filecount=`expr $filecount + 1` - done + filecount=`find 2>/dev/null "$_dir" -user "$login" -delete -print | \ + wc -l | sed 's/ *//'` echo " $filecount removed." done } -- cgit v1.2.3-56-ge451