Comment: A different approach (Score 1) on 2010.01.11 12:49
I've taken a different approach, which I haven't seen anyone mention anywhere else and which is universal across all unixes: I alias rm to a short script (rmx) which checks: Has any option been given? If so, then just do it. If not, how many filenames are being removed? If just one and either that filename is a file or symlink, then just do it. Otherwise, list all the filenames to be removed and prompt for confirmation before doing it.
This has the big benefit of allowing the common case where you specify the file to be removed with a wildcard and protects you when your wildcard accidentally matches more than one file. If you really want to remove more than one file, then either answer the prompt YES or specify -f.
My rmx script only allows a limited number of options (f,i,r,R) which are all I need at the command line.
The one drawback of all the "aliasing" approaches is that you become used to the "safety net" of your alias and might be more inclined to make a mistake on a system where your safety net is not in place for the user you're logged in as.
