Re: [SLUG] bash woes - my turn

From: Mike Branda (realraccoon@tampabay.rr.com)
Date: Wed Aug 03 2005 - 23:36:56 EDT


On Wed, 2005-08-03 at 17:13 -0400, Eben King wrote:
> On Wed, 3 Aug 2005, Mike Branda wrote:

>
> > if [ -e $logdir/$file1 ] && [ -e $logdir/$file2 ]
>
> You could maybe speed that up, dunno:
>
> if [[ ( -e $logdir/$file1 ) && ( -e $logdir/$file2 ) ]]
>
> With [], if $foo contains a space or other "bad" character, you have to
> write "$foo". Not so with [[]].

I just figured out that if [ -e $logdir/$file1 ] is what's doing it.
The idea was to test for the existance of one or both files and run
commands accordingly. So it's trying to test the expansion of both
files.

+ '['
-e /home/wacky1/cumulativelog/access.log.2005-07-01.gz /home/wacky1/cumulativelog/access.log.2005-08-01.gz ']

gotta love that -x flag of bash. Anyway, how do I tell it to care only
if a .gz file exists and not expand all of $file1 in the statement?

Thanks Again!

Mike Branda Jr.

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:41:48 EDT