On Tue, Jan 23, 2007 at 04:46:17PM -0500, Angelo Bertolli wrote:
> 
> #!/bin/bash
> 
> mv $@ ~/.Trash
> 
Hmm.  There are some problems here:

[EMAIL PROTECTED]:~$ which rm
/home/roberto/bin/rm
[EMAIL PROTECTED]:~$ touch test
[EMAIL PROTECTED]:~$ rm test 
[EMAIL PROTECTED]:~$ ls .Trash/
test
[EMAIL PROTECTED]:~$ touch test
[EMAIL PROTECTED]:~$ rm test 
mv: overwrite `/home/roberto/.Trash/test'? y
[EMAIL PROTECTED]:~$ touch test
[EMAIL PROTECTED]:~$ rm -f test 
[EMAIL PROTECTED]:~$ ls .Trash/
test
[EMAIL PROTECTED]:~$ mkdir testdir
[EMAIL PROTECTED]:~$ touch testdir/test
[EMAIL PROTECTED]:~$ rm -r testdir/
mv: invalid option -- r
Try `mv --help' for more information.
[EMAIL PROTECTED]:~$ touch test2
[EMAIL PROTECTED]:~$ rm -- test2
[EMAIL PROTECTED]:~$ ls .Trash/
test  test2

I'd say it needs some more smarts.

> exit 0
> 
This is universally bad.  You are declaring here that no matter the exit
code of the mv command, this script will exit successfully.  You should
generally exit with something like $? to make sure that the exit code
gets passed to the calling shell.

Regards,

-Roberto

-- 
Roberto C. Sanchez
http://people.connexer.com/~roberto
http://www.connexer.com

Attachment: signature.asc
Description: Digital signature

Reply via email to