[Ilugc] LJ Tip

  • From: sbharathi@xxxxxxxxxxxxx (Bharathi Subramanian)
  • Date: Thu Nov 22 09:39:25 2007

Magnatune an Open Choice, iTunes and Expensive Choice by James Lees
http://www.linuxjournal.com/article/9722 James explores the DRM-free
music site Magnatunes, the company whose cheeky motto is "We are not
evil."

LJ TIP: Redux of "Automatically Send Your rm Files to the Trash"
Last week we offered you a tip on aliasing the rm command, so that the
deleted files end up in the Trash rather than into the ether. Paul
from Switzerland and our in-house guru, Mitch Frazier, suggested some
changes as follows. First, here's what Paul said:

I don't like, I even hate, replacing dangerous commands as rm with a
seemingly safer version. There are two main reasons:

1. rm may be used by many scripts, system or personal, where the safer
command is not wanted (e.g. could overflow .Trash etc.)

2. Much more importantly, if you get used to a safe rm, you start to
use it (more) blindly, and when you are on an other machine without
safety belt you may make really bad mistakes. I have seen too many
accidents with similar redefinitions of rm with users moving to other
machines, helping colleagues, and destroying important files.

A better solution: name your safe version slightly differently. Why 
not:

alias rmt='mv --target-directory ~/.Trash'

Which reminds you that it is "rm into Trash". rmt is safe everywhere,
and not much more difficult to use than just rm. And the original rm
is still available, unchanged, for all existing scripts. Of course, it
is probably good to use rm or /bin/rm in scripts to have the original
one.

And here is Mitch Frazier's response:

I would agree with [Paul's] first point, it's probably not a good idea
to alias commands like rm in scripts. Particularly when the alias is
in another script altogether. Besides the problems he points out, you
don't want to do it because now your script won't work for anybody
else (since the alias is not in the script itself, it's in .bashrc).

The problem with the original tip is that (probably) rather than 
saying:

Put following into ~/.bashrc

it could have been:

Put following into ~/.aliases

When you put an alias in .aliases rather than in .bashrc it does not
get expanded when you run a shell script. Aliases from .aliases are
only expanded for interactive shells, ie you typing at the shell
prompt.  Putting it in .aliases, I would say, is a reasonable use of
an alias.  Personally, I'd rather make my life easier/safer during the
99.99% of the time that I'm typing on my system than worry about the
0.01% of the time when I'm working on somebody else's system. Stuff
happens everyday of the week, not just when you're at somebody else's
house.


The Other Desktop: Running XFCE
One of Linux's greatest strengths is that it's easily customized.  
Although most distributions ship with a variety of standard tools for
specific purposes (such as sendmail as a mail server or Vixie Cron to
handle repeated jobs), alternative tools are readily available. You
can rip out just about any component, either removing it entirely or
replacing it with something else. Linux lets you remove or replace
more components than most operating systems, allowing the savvy
administrator to customize a Linux installation for specific purposes.

http://responses.linux-mag.com/ct.html?rtr=on&s=ax0v,6v82,33o,b5so,1zna,96lb,6o2h
 

HTH :)
-- 
Bharathi S

Other related posts:

  • » [Ilugc] LJ Tip - Bharathi Subramanian