Hey PTrenholme thanks for the input so far.
The script is incomplete so far, but I try to code and test as I go rather then come up with a giant script that doenst work and begin working out the bugs.
Plus, Im doing this between working on sys admin tasks so it comes along slowly.
Anyway, as I said, the script is suppose to run through the ./user file which contains only 3 lines at this point(the usernames of FTP users)
fatman
sue-238
littleboy
and thats it. I put it in a loop so the script could work in iterations and this seemed like an easy way to do it. So it goes and assigns variable TMP to the results of a file name and path newer then the current setting in LAST. If there is no newer file, it returns blank, which was basically voiding the rest of the test so I through that if statement in there. So if TMP is blank, then it sets the contents of the variable to what it was before the newer test(thus keeping the latest file in the variable), and then outputting that to txt files so the values stay for the next iteration(I was having troubles with variables at the start of the script so to be safe i echoed the contents to txt files)
The output is strictly for testing right now, just to see if the test worked. The output is rather strange for me and ill explain why:
TMP BEFORE TEST = fatman/test.jpg<-newer file then the contents of LAST
TMP OLDER = sue-238/words.bmp<-somehow the TMP var is blank for the if so it returns the older file variable
TMP = sue-238/words.bmp<-after the test, still the older variable to be expected
LATE= sue-238/words.bmp<-same
TMP BEFORE TEST = sue-238/cloud.jpg<-newer file then what is in LAST
TMP OLDER = sue-238/words.bmp<-returns old file again, but WHY? ? ? ! GRAR
TMP = sue-238/words.bmp<-same as above
LATE= sue-238/words.bmp<-same as above
TMP BEFORE TEST = littleboy/test.jpg littleboy/test2.jpg<-both newer then LAST
feeder.sh: line 15: [: littleboy/test.jpg: unary operator expected<-error from it returning more then 1 file name i understand this
TMP NEWER = littleboy/test.jpg littleboy/test2.jpg <- both files newer
TMP = littleboy/test.jpg littleboy/test2.jpg<-both files newer
LATE= littleboy/test.jpg littleboy/test2.jpg<-both files newer
out of 3 iterations, the script worked on the last one, but not the first two, why??
Here are the contents of those directories
atombomb@atombombcafe.com [~/public_html]# ls -alh littleboy fatman sue-238
fatman:
total 68K
drwxr-xr-x 2 atombomb atombomb 4.0K Feb 22 13:40 ./
drwxr-x--- 16 atombomb nobody 4.0K Feb 23 09:40 ../
-rw-r--r-- 1 atombomb atombomb 54K Feb 22 13:40 test.jpg
littleboy:
total 192K
drwxr-xr-x 2 atombomb atombomb 4.0K Feb 22 13:35 ./
drwxr-x--- 16 atombomb nobody 4.0K Feb 23 09:40 ../
-rw------- 1 atombomb atombomb 4 Feb 12 03:58 .ftpquota
-rw-r--r-- 1 atombomb atombomb 54K Feb 16 01:55 Life.jpg
-rw-r--r-- 1 atombomb atombomb 54K Feb 22 13:35 test2.jpg
-rw-r--r-- 1 atombomb atombomb 54K Feb 21 10:55 test.jpg
sue-238:
total 2.9M
drwxr-xr-x 2 atombomb atombomb 4.0K Feb 20 15:01 ./
drwxr-x--- 16 atombomb nobody 4.0K Feb 23 09:40 ../
-rw-r--r-- 1 atombomb atombomb 846K Feb 10 15:36 100_5033.jpg
-rw-r--r-- 1 atombomb atombomb 605K Feb 20 15:01 cloud.jpg
-rw------- 1 atombomb atombomb 4 Feb 9 18:07 .ftpquota
-rw-r--r-- 1 atombomb atombomb 704K Feb 20 15:01 words.bmp
-rw-r--r-- 1 atombomb atombomb 704K Feb 11 18:17 wtf.bmp
all of the help is definitely appreciated. I will work on understanding your updates to my code.