Re: alias(rm as mv)

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

 



On Mon, Oct 06, 2003 at 04:22:36PM -0300, Herculano de Lima Einloft Neto wrote:
>   I'm not sure this is what you want, but you could use:
> 
> del() { mv -i $* ~/.Trash; }
> 
>   You can put it in ~/.bashrc
>   You should find a lot about this searching around.. you shouldn't use
> rm as the new command's name, to keep the respect for it.
> 
>   On this subject, if anyone can help:
> 
>   I'm trying to make it better, something like:
> 
>     for i in $*; do
>         dn=`dirname $i`
>         bn=`basename $i`
>         name=$dn/$bn
>         echo $name >> ~/.trashdb;
>     done
>     mv -i $* ~/.Trash;
> 
> Except this doesn't work.. could anyone please tell me the way to get a
> file's absolute name from within a script?

Quick solution:
here=`pwd`
     for i in $*; do
	 absolutename="/${i}"
         dn=`dirname $i`
         bn=`basename $i`
         name=$dn/$bn
         echo $absolutename >> ~/.trashdb;
     done
     mv -i $* ~/.Trash;

You still have the massive probleme of files that all posses the same 
basename even though they came from different directories.

Best bet - append the file being "trashed" to an existing gzipped tar
archive. This way the full pathname can be saved with each file nad each
file can besaved mutiple times in the archive.  To save pain at a later
date you can prepend each pathname with a "date_and_timestamp" making
it easier to name each version of the same file uniquely and allow
each one to be manipulated individually.

-- 
Jeff Kinz, Open-PC, Emergent Research,  Hudson, MA.  jkinz@xxxxxxxx
copyright 2003.  Use is restricted. Any use is an 
acceptance of the offer at http://www.kinz.org/policy.html.
Don't forget to change your password often.


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux