Strange problem.


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Strange problem.
# 1  
MySQL 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:

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

Any Suggestions?
# 2  
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
# 3  
homework IS against the rules... thread closed!
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #756
Difficulty: Medium
The difference between EPROM and EEPROM based on the way that the memory programs and erases.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Strange mget problem

Hi! I'm a bit of a unix n00b so be gentle! I need to use ftp to download some files. I have the ftp running in a shell script which had been working perfectly last week. I downloaded around 400 files before it broke on friday. Now whenever I try to run the script, it starts to download... (3 Replies)
Discussion started by: johnnybongo
3 Replies

2. Shell Programming and Scripting

strange problem

hello all, i am having problem in accessing a directory.I dont think its a permission issue.can anyone help me out. I am using korn sell code: $ ls -ltr sc* lrwxrwxrwx 1 essbase essbase 21 Oct 8 2010 sc_ssp -> /work/nfs/nas2/sc_ssp $ cd sc_ssp ksh: sc_ssp: not found $ (6 Replies)
Discussion started by: manid
6 Replies

3. Shell Programming and Scripting

Strange Problem

Hi All, I am encountering an unexpected problem while running my process, using daemon placed in /etc/init.d/. I have a process that is opening shared library using dlopen. When I run my process on the command line, it is able to open the library. But when I used daemon to run my process, I... (0 Replies)
Discussion started by: qwerty-1
0 Replies

4. UNIX for Dummies Questions & Answers

Strange problem with rsh

Hello All, I'm facing a weird problem with rsh. There are 2 machines: host1.domain1.com and host2.domain2.com. I have setup $HOME/.rhosts file in both the hosts. When I login to host2.domain2.com and issue: $ rsh host1 It works fine but when I login to host1.domain1.com and... (2 Replies)
Discussion started by: sacguy08
2 Replies

5. UNIX for Dummies Questions & Answers

strange ftp problem

I have got a strange problem on ftp ... I am connected to a remote server through vpn and trying to get some autocad drawing to my computer. I am using get command and trying to do binary transfer Strange thing is I can get few drawings but one and everytime i try to get that drawing it will... (3 Replies)
Discussion started by: ajnabi
3 Replies

6. Shell Programming and Scripting

Strange problem

I am using SunOS 5.9 and I don't know why all my commands are getting executed as if an extra 'enter' has been pressed. What could be the reason and how to correct it? Please help. Asty (2 Replies)
Discussion started by: Asty
2 Replies

7. Linux

very strange problem

I have installed Fedora Core on a Toshiba Satellite Pro4600 laptop recently I have experienced a rather mysterious problem if I touch anything specially the keyboard or mouse I see this stuff “67yujhnmyyy” straight away some time it won’t stop for while like this... (5 Replies)
Discussion started by: kemobyte
5 Replies

8. UNIX for Dummies Questions & Answers

strange...problem

Hi.. Some of my application were not running properly due to lack of virtual memory.....so wht i did add one free harddisk as swap file system...and increased the swap memory.. But since than my root file system is showing 100% full thr is no space left...is thr any link between these two..... (1 Reply)
Discussion started by: Prafulla
1 Replies

9. UNIX for Dummies Questions & Answers

Strange Problem

I did an installation of Redhat 7.1 and it seem to install smoothly. I go and reboot and I get the following message: "INIT: Id "x" respawing too fast: disabled for 5 minutes" The screen flashes 4 times every 10 seconds or so. I can't seem to figure why this does this. It might be a simple... (2 Replies)
Discussion started by: forjohnny
2 Replies

10. UNIX for Dummies Questions & Answers

Strange problem.Please Help !

I¡¯m a network operator, mine is an IBM PC server 320, operating system SCO unix 3.2v4.2, triton 3.1 of Baan. Recently, my server went dead every a few hours, no sign & signal shows malfunction suddenly. It looks like a sudden power failure, but the indicator of main power supply is on. Normal... (1 Reply)
Discussion started by: lyhsm
1 Replies

Featured Tech Videos