![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strange problem | Asty | Shell Programming and Scripting | 2 | 08-10-2006 03:44 AM |
| Strange FTP problem | widder | HP-UX | 4 | 06-08-2006 09:17 AM |
| very strange problem | kemobyte | Linux | 5 | 03-31-2004 11:47 PM |
| Strange Problem | forjohnny | UNIX for Dummies Questions & Answers | 2 | 09-28-2001 11:24 AM |
| Strange problem.Please Help ! | lyhsm | UNIX for Dummies Questions & Answers | 1 | 12-01-2000 12:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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: Code:
!/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
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|