D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Bash question

 

On Sun, 8 Jan 2006, Neil Stone wrote:

However I want to be able to invoke this via cron.. but only if a (or
many) file(s) excist in a given directory... and if not, just quit...

You'll find reading "man test" very helpful...

NO_OF_FILES=`ls ${DIRECTORY}/*.eps|wc -l`
if [ $NO_OF_FILES -ge 1 ]; then
        # do stuff
fi

Alex.

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe. FAQ: www.dcglug.org.uk/linux_adm/list-faq.html