Art Alexion on 1 Feb 2006 17:47:13 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Interactive rm


Michael C. Toren wrote:

>Art Alexion wrote:
>  
>
>>>How can I restore rm's default behavior so that "rm *" requires
>>>confirmation, but "rm specified_file" does not?
>>>      
>>>
>
>gyoza@comcast.net wrote:
>  
>
>>Create an alias.
>>    
>>
>
>morgan wrote:
>  
>
>>If you're using bash you would create an alias:
>>
>>alias rm="rm -i"
>>    
>>
>
>Creating an alias won't solve Art's problem, which is using the "-i" flag
>when rm is passed multiple files, but not using "-i" when only a single
>file is specified -- rather, an alias will use "-i" in every case.  One
>possible solution is to create a bash function which determines how many
>arguments it was passed:
>
>	rm()
>	{
>	    if [ $# -lt 2 ]
>	    then /bin/rm $*
>	    else /bin/rm -i $*
>	    fi
>	}
>
>This works for the majority of cases:
>
>	[mct@ellesmere ~]$ touch foo bar baz
>	[mct@ellesmere ~]$ rm foo
>	[mct@ellesmere ~]$ rm bar baz
>	/bin/rm: remove `bar'? y
>	/bin/rm: remove `baz'? y
>
>  
>

Michael,

Where would I put that function?

-- 

_______________________________________
Art Alexion
Arthur S. Alexion LLC

PGP fingerprint: 52A4 B10C AA73 096F A661  92D2 3B65 8EAC ACC5 BA7A
The attachment -- signature.asc -- is my electronic signature; no need for alarm.
Info @ http://mysite.verizon.net/art.alexion/encryption/signature.asc.what.html

Key for signed PDFs available at
http://mysite.verizon.net/art.alexion/encryption/ArthurSAlexion.p7c
The validation string is TTJY-ZILJ-BJJG.
________________________________________

Attachment: signature.asc
Description: OpenPGP digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug