home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume3 / rmsecure / rmsecure.csh next >
Linux/UNIX/POSIX Shell Script  |  1986-11-30  |  1KB  |  69 lines

  1. #! /bin/csh -f
  2. # csh script ; secure remove of files
  3. onintr out
  4. set interact
  5. set force
  6. set recur
  7. set minus
  8. while ("$1" == "-" || "$1" =~ -[f,i,r])
  9.     switch ($1)
  10.     case -i: 
  11.         set interact=-i
  12.         shift
  13.         breaksw
  14.     case -f: 
  15.         set force=-f
  16.         shift
  17.         breaksw
  18.     case -r: 
  19.         set recur=-r
  20.         shift
  21.         breaksw
  22.     case  -: 
  23.         set minus=-
  24.         shift
  25.         break
  26.     endsw
  27. end
  28. if ($interact == -i) then
  29.     /bin/rm -i $force $recur $minus $*
  30.     exit($status)
  31. endif
  32. set f1=`echo $0`
  33. set f1=$f1:t" : remove"
  34. set r
  35. while ("$1" != '')
  36.     set b=`echo $1`
  37.     if ("$b" != '') then
  38.     set noglob
  39.     set a=$1
  40.     unset noglob
  41.     if ("$a" == "$b") then
  42.         set r="$r $b"
  43.     else
  44.         if ($#b == 1) then
  45.         echo -n $f1 $b '? '
  46.         if ( $< == "y" ) then
  47.             set r="$r $b"
  48.         endif
  49.         else
  50.         echo -n $f1 $b '? '| fold
  51.         if ( $< == "y" ) then
  52.             set r="$r $b"
  53.         else
  54.             foreach n ($b)
  55.             echo -n $f1 $n '? '
  56.             if ( $< == "y" ) then
  57.                 set r="$r $n"
  58.             endif
  59.             end
  60.         endif
  61.         endif
  62.     endif
  63.     endif
  64.     shift
  65. end
  66. /bin/rm $force $recur $minus $r
  67. out: 
  68. exit(0)
  69.