[vox] Stupid User Tricks

Mark K. Kim vox@lists.lugod.org
Wed, 14 May 2003 12:37:29 -0700 (PDT)


On bash, try writing a script:

   /bin/rm-safe:
      #!/bin/bash

      # Configurable
      TRASH=$HOME/Trash

      # Create the trash directory, if it doesn't exist
      if [ \! -d "$TRASH" ]; then
         mkdir $TRASH
      fi

      # Move the file to the trash
      mv $* "$TRASH"

then:

   alias rm='/bin/rm-safe'

or something similar.  it creates ~/Trash automatically, to boot!  but
`rm -rf dir` yields:

   mv: invalid option -- r
   Try `mv --help' for more information.

what's more, a simple `rm dir` yields moving the directory to the ~/Trash.
Somewhat unfortunate.

-Mark

On Wed, 14 May 2003, Jay Strauss wrote:

> I use bash, (and after writing my reply realized it probably wont work in
> bash)
>
> Jay
> ----- Original Message -----
> From: "Peter Jay Salzman" <p@dirac.org>
> To: <vox@lists.lugod.org>
> Sent: Tuesday, May 13, 2003 10:31 PM
> Subject: Re: [vox] Stupid User Tricks
>
>
> > jay, surely you don't use csh?!?   ;)
> >
> > just kidding, of course.
> >
> > pete
> >
> >
> >
> > On Tue 13 May 03, 10:09 PM, Jay Strauss <me@heyjay.com> opined:
> > > That's what I figured, but didn't know what language it was in.  Thanks
> (and
> > > adding it to my machine now)
> > >
> > > Jay
> > > ----- Original Message -----
> > > From: "Peter Jay Salzman" <p@dirac.org>
> > > To: <vox@lists.lugod.org>
> > > Sent: Tuesday, May 13, 2003 9:22 PM
> > > Subject: Re: [vox] Stupid User Tricks
> > >
> > >
> > > > hi jay,
> > > >
> > > > has nothing to do with a regex, although it certainly looks like one.
> > > >
> > > > i had to look twice before i realized that it's a csh style glob.
> > > > basically \!* means "all arguments" in csh/tcsh.
> > > >
> > > > pete
> > > >
> > > >
> > > > On Tue 13 May 03,  9:01 PM, Jay Strauss <me@heyjay.com> opined:
> > > > > I get what it does, but not how it does it.
> > > > >
> > > > > what is \!*, is this a regex?  If so it looks like "not anything",
> which
> > > > > obviously it can't be.
> > > > >
> > > > > Jay
> > > > > ----- Original Message -----
> > > > > From: "Norm Matloff" <matloff@laura.cs.ucdavis.edu>
> > > > > To: <vox@lists.lugod.org>
> > > > > Sent: Tuesday, May 13, 2003 5:52 PM
> > > > > Subject: Re: [vox] Stupid User Tricks
> > > > >
> > > > >
> > > > > >
> > > > > > I had thought that everyone had rm aliased, e.g.
> > > > > >
> > > > > > alias rm 'mv \!* ~/Trash'
> > > > > >
> > > > > > Norm
> >
> > --
> > GPG Instructions: http://www.dirac.org/linux/gpg
> > GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
> > _______________________________________________
> > vox mailing list
> > vox@lists.lugod.org
> > http://lists.lugod.org/mailman/listinfo/vox
> >
> >
>
> _______________________________________________
> vox mailing list
> vox@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox
>

-- 
Mark K. Kim
http://www.cbreak.org/
PGP key available upon request.