> >>>How do i write an infinite loop to monitor the creation and removal of
> >>>.pdf or .PDF files under the current directory. Every 15 seconds i want
> >>>to display a list of those filenames created or removed after the
> >>>previous display. Without loss of practical significance of this
> >>>utility, I want to assume that the time interval between creation of a
> >>>.PDF or .pdf file and removal of a .PDF or .pdf file is over 15
> >>>seconds, which means that it's unnecessary for my script to handle
> >>>the situation where creation of a file is followed by immediate removal
> >>>of a file. I think i need to use the comm or comm commands here.
> >>Something like this (untested) would be the simplest:
> >>ls *.pdf *.PDF > old
> >>while :
> >>do
> >> sleep 15
> >> ls *.pdf *.PDF > new
> >> newOnly=`comm -13 old new`
> >> oldOnly=`comm -23 old new`
> >> echo "created: $newOnly"
> >> echo "removed: $oldOnly"
> >> mv new old
> >>done
> >>Check the "comm" man page for the arguments.
> > Thanks Ed for your advice, that is similiar to what i have written
> > here. However, i have been testing my syntax, which is similiar to
> > yours, and still doesn't seem to work. Have a look at my code ,and tell
> > me if you see anything out of ordinary.
> > UW PICO(tm) 3.5 File: pdf.sh
> > ls *.[pP][dD[fF] >older 2>/dev/null
> You're missing a closing square bracket ] after the "D" above.
> > while true
> > do
> > sleep 15echo "No pdf files have been created or removed in the last 15
> The above is missing a newline and a closing double quote ".
> > ls *.[pP][dD[fF] >newer 2>/dev/null
> You're missing a closing square bracket ] after the "D" above.
> > count='comm -13 $A $B | wc l'
> The above forward ticks ' should be back ticks `. Or use $(...) syntax.
> > else if [ $count -gt 0 ]; then
> > echo "No pdf files have been created or removed in the last
> > 1515
> > seconds"conds"
> The above seems to have an extra double quote in addition to messed up
> newlines.
> > comm -23 $A $B$A $B comm -12
> The above is just messed up.
> > comm -13 $A $B
> > else
> > echo" The following pdf file(s) have been removed in the last
> > 15
> > seconds"
> Messed up newlines.
> > unalias pdf.sh
> What's the above supposed to do?
> > done
> > If you can test the code on your unix machine cutting and pasting, and
> > seeing what's causing the issue. I'm interesting to see what i am doing
> > wrong. Appreciate it bud!
> Regards,
> Ed.
was good. I am still having problems with my syntax