On Tue, Oct 09, 2007 at 01:02:37PM -0400, Ben Scott wrote:
> On 10/8/07, Steven W. Orr <[EMAIL PROTECTED]> wrote:
> > if [[ blah1 && blah2 ]]
> > otherwise you'd have to say
> > if [ blah1 ]] && [ blah2 ]
> > which I'm hoping won't generate a different set of questions.
> 
>   (I'm assuming, in the second example, the doubled
> right-square-bracket after "blah1" is a typo.)
> 
>   Can't you just say
> 
>       [ blah1 -a blah2 ]
> 
> for the second one?  That's what I've always done.  I supposed,
> aesthetically, one might prefer the use of && over -a because it looks
> more like C or makes one think of "and" or whatever, but beauty is in
> the eye of the beholder and all that.

Notes from the autoconf folks about shell portability make interesting
reading, if you lean that way.  I'm sure there are other guides, but I
think of this because configure scripts have lots of things that you
might scratch your head about.  Not all of which are explained by
the notes :)

   
http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_chapter/autoconf_10.html

Oddly there is no mention of the '==' thing, possibly they didn't
consider that people used to 'test' syntax would use it.  They do say:

    If you need to make multiple checks using test, combine them with
    the shell operators `&&' and `||' instead of using the test
    operators `-a' and `-o'. On System V, the precedence of `-a' and
    `-o' is wrong relative to the unary operators; consequently, POSIX
    does not specify them, so using them is nonportable. If you combine
    `&&' and `||' in the same statement, keep in mind that they have
    equal precedence.

mm
_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to