On Tuesday, Oct 9th 2007 at 16:04 -0000, quoth Mark E. Mallett: =>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.
And it's a good thing that the precedence is equal too. if p then something_true else something_false fi is equal to p && something_true || something_false It's nice to use this construct when it doesn't go longer than an 80 column line. -- Time flies like the wind. Fruit flies like a banana. Stranger things have .0. happened but none stranger than this. Does your driver's license say Organ ..0 Donor?Black holes are where God divided by zero. Listen to me! We are all- 000 individuals! What if this weren't a hypothetical question? steveo at syslang.net _______________________________________________ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/