scripting help
Tyler Aviss
tjaviss-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Aug 2 20:31:02 UTC 2007
How about this?
if [ $( find ${TOMCAT}build/backup -iname "*war_????????-????" -mtime
-${BACKUPAGE} 2>/dev/null | wc -l ) -gt 0 ] ; then echo "I will do
something now"; fi
On 8/2/07, Neil Watson <tlug-neil-8agRmHhQ+n2CxnSzwYWP7Q at public.gmane.org> wrote:
> I want to check, in a script, for a file or files that are less than x
> number of days old. If those conditions are met then do something. I
> had something like this in mind:
>
> find ${TOMCAT}build/backup -iname "*war_????????-????" \
> -mtime -$BACKUPAGE || echo "No files found!"
>
> However, I believe that if find encounters any errors, like permission
> denied, the exit value would change and the test would fail.
>
> Can someone suggest a better way?
>
> --
> Neil Watson | Debian Linux
> System Administrator | Uptime 25 days
> http://watson-wilson.ca
> --
> The Toronto Linux Users Group. Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
>
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list