Strange problem.

Well, my script started off to do what i wanted. Now, i think its not recognizing the pattern so its not moving anything.

What i have to do is execute my script command for the move to take effect. So i did that and yayy it worked.

Strange thing is that my DESTDIR was empty to begin with. So how did those files get their if it doesnt work? I probably should of echo'd a mv and displayed a time and date thing.

Maybe im missing something here:

 
!/bin/sh
#File: HelloMail
#Class: CS Unix
#Purpose: To inefficiently move my mail from one place to another.
 
MAILDIR="/var/spool/mail/firstname.lastname"  <-- Path does exist
TEXT="hello"
DESTDIR="$HOME/Mail/Hello"  <-- path does exist
 
find "$MAILDIR" -type f | while read N   #This will find my Mail and read it
                                         #But to do that read needs a varaible.
do                                       #Begin the body of the while loop
       cat "$N" | grep -q "$TEXT"        #Using N as the location of my mail
       if [ $? == 0 ]; then              #If my text is matched at least once
           mv "$N" "$DESTDIR"            #Move my inbox mail int my mail folder
       fi                                #end my if statement with fi
done #end while
#eof

Any Suggestions?

Was working but no more?
Was it working while you were writing/tesing it, then it stopped since you put it in batch mode (cron...)
Then it doesnt have your env loaded... and so no HOME variable, and //Mail/Hello certainly doesnt exist...

Just thoughts...
Regards

homework IS against the rules... thread closed!