From: toshiya@sra.co.jp (Toshiya Kiriyama)
Subject: Re: unerase rm file
	<T91124KK.92Dec14203722@cs0.sfc.keio.ac.jp>
	<KANEKO.92Dec15202633@grain.rcais.tohoku.ac.jp>
	<351444467@ihalon.oa.sharp.co.jp>
	<SENDA.92Dec17195024@cr-x.kuis.kyoto-u.ac.jp>
	<KANEKO.92Dec17204905@grain.rcais.tohoku.ac.jp>
Organization: Software Research Associates, Inc., Japan
Date: Tue, 22 Dec 1992 15:20:22 GMT
Distribution: fj


In article <KANEKO.92Dec17204905@grain.rcais.tohoku.ac.jp>
kaneko@rcais.tohoku.ac.jp (Yutaka Kaneko) writes:
  >   $BElKLBg$N6b;R$G$9!#(B
  > In article <SENDA.92Dec17195024@cr-x.kuis.kyoto-u.ac.jp>
  senda@kuis.kyoto-u.ac.jp (Shuji Senda) writes:
  >   > # $B$G$b;d(B$B$N>l9g(B \rm -rf foo $B$H$+$d$C$F$7$^$&JJ$,$D$$$F$$$k$N$G$9(B
  >   > # $B$/$$$h$&$,$"$j$^$;$s$,!#(B(^_^;

  \rm $B$NJJ$,$D$$$F$7$^$&$N$H!"(Brm -i $B$G(B "y" $B$rO"BG$9$k$N$,JJ$K$J$k$N$O!"(B
  $BKX$s$IF1$8$3$H$G!"MW$O!"?M4V$N!V(B$B=,47!W%l%Y%k$N$b$s$G$9$h$M!#(B

  $B;d$b!"(Brm $B$G$O2?EY$bDK$$L\$K$"$C$F$-$^$7$?$,!">/!9$N%O!<%I%k$G$O!"$9$0(B
  $B$K47$l$,DI$$$D$$$F$7$^$C$F!"$I$&$K$b$J$i$J$+$C$?$N$G!"<+J,$N@lMQ(B rm $B$r(B
  $B:n$C$F$7$^$&$H$$$&J}K!$K=P(B$B$^$7$?(B($BCg4VFb$NI>H=$O0-$$$1$I!D(B $B!g(B;)$B!#(B

  $B2<$N$h$&$J%9%/%j%W%H$r(B ~/bin $B$K$*$$$F!"(Bpath $B$N@hF,$K(B ~/bin $B$r$*$$$F$7(B
  $B$^$&$H(B($B$A$g$C$H9S$C$]$$(B ^^;)$B!"(B\rm $B$r$d$m$&$,!"(Byes | rm (aliased for
  "rm -i") $B$r$d$m$&$,(B$B!"I,$:(B "mv" $B$H$7$F5!G=$7$^$9!#(B

  rm $B$5$l$?%U%!%$%k(B/$B%G%#%l%/%H%j$O!"(Bfoo -> ./.foo~ $B$H$J$k$@$1$J$N$G!"(B$B4J(B
  $BC1$KI|3h$G$-$^$9$7!"%M%C%H%o!<%/Fb$r6n$1$:$j$^$o$k$3$H$b$J$$$N$G!"Aa$/(B
  $B$F$*<j7Z$G$9!#(B

  $B$"$H$O(B$B!"(B.logout $B$+$i$*A]=|%9%/%j%W%H$rAv$i$;$F!"0lDjF|?t0J>e7P$C$F$$$k(B
  ".*~" $B$r>C$7$F>e$2$k$H8@$&Lu$G$9(B($B6b(B$BMKF|$K>C$7$F7nMK$KI|3h$G$-$J$$$H:$(B
  $B$k$N$G!"BgBN(B3$BF|0J>e$,$*4+$a(B ^^)$B!#(B

  $B$$$D$b$OC1=c$K(B rm $B$G$h$$$7!"(B$B$&$k$5$/J9$$$F$3$J$$$N$GJQ$JJJ$b$D$-$^$;$s(B
  $B$,!"M#0l:$$k$N$O!"%9!<%Q!<%f!<%6$K$J$C$?;~!"7Z$$5$;}$A$G(B rm $B$rBG$C$F$7(B
  $B$^$&$3$H$G$9$M(B ( $B!D(B $B$&!A$s!"$d$C$Q$j47$l(B/$BJJ$O62$m$7$$$J(B ..;)

 -----8<---------------------------------------------------------
#! /bin/csh -f
set opt				# /bin/rm option
set file			# default variable
set NORMALFILE
onintr EX
# cp version
#	1.0	from May, 1986
# tar version
#	2.0	from Apr, 1987
# mv version
#	3.0	22 Aug,1990

if ( "$argv[1]" == "-b" ) then
	shift
	/bin/rm $argv[*]		# run same as /usr/bin 
	exit $status
endif

foreach f ( $* )
	switch ($f)
		case -r:
			unset NORMALFILE
			breaksw
		case -*:
				# argument is option
			set opt = ( $opt $f )
			breaksw
		default:
			set file = ( $file $f )
			breaksw
	endsw
end

foreach f ( $file )		# each argument file function 
	set FNAME = $f:t	# get file name
	set PATHNAME = $f:h	# get pathname
	if ( $FNAME == $PATHNAME ) set PATHNAME = '.'
	if ( -e $f ) then
		if ( $?NORMALFILE ) then
			if ( -d $f ) then
				echo "rm : " $f "is directory"
				@ status += 1
				exit $status
			endif
		endif
		/bin/mv $opt $f ${PATHNAME}/.${FNAME}\~
	else
		echo "rm : " $f "not found."
		@ status += 1
		exit $status
	endif
end

EX:
exit $status
--
	$B6M;3=SLi(B(toshiya@sra.co.jp) Says as ever "$B;E;v(B $B!c(B $B2HDm(B $B!c(B $B<r(B".
	Dans	$B%3%s%5%k%F%#%s%0K\It(B [$BLk4V(B$BIt(B]
		Software Research Associates,Inc.
	Phone   81-3-5395-7521/Ex.(81)1521,Fax:81-3-5395-7542