Re: alias(rm as mv)

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

 



Himanshu Arora wrote:
> Hi All!
> i want rm command to be converted into
> 
> mv (whatever is there after rm command) Trash/
> 
> where Trash/ is the final destination.
> But the alias command doesn't have any support for the above mentioned 
> purpose. Could you suggest me a way to convert rm into mv ?
> Himanshu Arora
> IIIT Hyderabad


  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?

Thanks in advance,
-- 
Herculano de Lima Einloft Neto <hlen@xxxxxxxxx>


-- 
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