[ means test right? Maybe? (was: Re: GOTCHA in Ubuntu - broken shell)
Jeffry Smith
jsmith at alum.mit.edu
Mon Oct 1 12:08:52 EDT 2007
On 10/1/07, Tom Buskey <tom at buskey.name> wrote:
>
> Here's the relevant bash (3.2.9) man page on Fedora 7:
>
>
> string == pattern
> True, if string matches pattern. Any part of pattern can
> be
> quoted to cause it to be matched as a string. With a
> successful
> match to a pattern, the .sh.match array variable will
> contain
> the match and sub-pattern matches.
> string = pattern
> Same as == above, but is obsolete.
>
> And Solaris (bash 3.00.16):
> string1 == string2
> True if the strings are equal. = may be used in place
> of == for strict POSIX compliance.
>
> Sounds like dash isn't fully cooked. == is used & works in ksh, bash and
> sh.
>
Actually, dash is fully cooked - note that those are bash pages. Note
specifically on Solaris: "= may be used in place of == for strict
POSIX compliance."
I don't have access to the dash man page right now, but the Ubuntu
reason for dash is that it's Posix compliant. "==" may work, but
you're depending on non-standard (as in de jure) behavior.
Not saying I agree with the decision, merely pointing out saying that
"dash isn't fully cooked" when it supports POSIX when in POSIX mode,
and bash for some reason accepts other things that are not specified
by POSIX is not a good arguing point.
jeff
More information about the gnhlug-discuss
mailing list