Amanda-Users

Re: Putting on my Amanda hat

2004-07-22 11:59:02
Subject: Re: Putting on my Amanda hat
From: Dave Sherohman <dsherohman AT westling DOT com>
To: Amanda List <amanda-users AT amanda DOT org>
Date: Thu, 22 Jul 2004 10:47:57 -0500
On Wed, Jul 21, 2004 at 05:49:48PM -0400, Jon LaBadie wrote:
> In a 'real' bourne shell $(...) is not available, but `...` is.

And I was so sure it was the other way around...  This was pointed out
to me offlist by someone else, too.  Ah, well.

I actually wrote it using `...` first, but nesting them confused the
shell, so I changed it to something where the begin/end delimiters
were different.

> However this can be simplified if you are working in a
> posix-compatible shell.  The math operators ((...)) provide
> a return code of 0 or 1 depending on the zero/non-zero value
> of the result.  So you could do (ignoring cron required escapes)
> 
>   (( $(date +%U) % 2 )) && ...

Very nice!  Thanks!


<Prev in Thread] Current Thread [Next in Thread>