ok guys...
this is weird...
first the info...
$TRASH=/home/.trash
trash has:
/home/.trash
+ files/
+ info/
+ [bunch of files]
I am making a little script which has the following function:
Code:
clean()
{
find $TRASH/* -name 'files' -prune -o -name 'info' -prune -o -delete
find $HOME -name "*~" -delete
}
So basically i want to delete everything in trash EXCEPT those two folders.
I also have a nice alias:
Code:
alias exit="clean && exit"
Now comes the fun.
Code:
[~]$ ls $TRASH
files/ temp13 temp2 temp26 temp32 temp39 temp45 temp51 temp30
info/ temp58 temp64 temp70 temp77 temp83 temp9 temp9 temp 50
[~]$ clean
[~]$ ls $TRASH
files/ info/
[~]$
so it IS working as I want right?
now:
Code:
[~]$ echo $TRASH
/home/.trash
[~]$ ls $TRASH
files/ temp13 temp2 temp26 temp32 temp39 temp45 temp51 temp72
info/ temp14 temp20 temp27 temp33 temp4 temp46 temp52 temp59
[~]$ exit
find: /home/.trash: No such file or directory
find: /home/.trash: No such file or directory
find: /home/.trash: No such file or directory
find: /home/.trash: No such file or directory
find: /home/.trash: No such file or directory
... [ad infinitum, until ^C]
[~]$ ls $TRASH
/bin/ls: cannot access find: /home/.trash: No such file or directory
[~]$
yes it deletes $TRASH!! (and as a little side effect it doesnt exit)
but why??
can somebody explain me the logic on that??
EDIT:Thanks for the corrections guys I had been too much on the computer, made some typos there. I just took a time out now im more awake!