On Saturday 17 November 2007 16:24, Bryen wrote:
> On Sat, 2007-11-17 at 15:53 -0800, Randall R Schulz wrote:
> > On Saturday 17 November 2007 15:41, Bryen wrote:
> > > On Sat, 2007-11-17 at 15:30 -0800, Randall R Schulz wrote:
> > > > ...
> > > >
> > > > I've known users (dare I say, "lusers") to override rm with a
> > > > script that moves the target files to a trashcan folder.
> > >
> > > Hmm... That would be an interesting project to try to create. 
> > > What a way for me to flex my current knowledge and expand on it. 
> > > :-)
> >
> > It's no big deal. Write an "rm" replacement script that moves files
> > to a specified trash folder rather than simply unlink them. ...
>
> So how would a script called rm not conflict with the real rm McCoy?
> Nothing to you, but I'm just starting to get into scripting.  :-)

It's a matter of precedence. You put the replacement "rm" in a directory 
that is checked before the stock one (/bin).


> Critique me here.  As I'm going by theory.  I would move the
> current /bin/rm to a new location.

Whoa! No, no no. Never do that!!

No, just create a directory ~/bin (equally, $HOME/bin) and put your 
personal scripts there. Make sure that directory precedes the stock 
directories in the PATH variable. (I don't recall if $HOME/bin is part 
of the stock PATH or not, but if it isn't, add a line like this to 
your "$HOME/.bash_profile" script:

PATH="$HOME/bin:$PATH"

> Then I would create an rm script 
> and place it in /bin where the current rm was located.

No. Put it in ~/bin ($HOME/bin).


> But within the rm script, I would point to the rm command's full path
> when using rm's functionality.

Well, the point is to avoid what the stock "rm" does and instead move 
the file to an out-of-the-way place from which you can retrieve it 
should you change your mind.


> Thus users would never see the difference when they run /bin/rm, but
> the script does the interpretation to /somewherelse/rm.
>
> Did I figure it out right?

Uh. Keep trying.

Perhaps for someone as new to all this as you, playing around with 
replacements for key OS utilities isn't the best idea.

You could use Konqueror or ... what's it called? There's a Gnome file 
manager, too. They're GUIs that have trash cans and "Empty Trash" 
commands and all that usual stuff.


> --
> ---Bryen---


Randall Schuzl
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to