[ means test right? Maybe? (was: Re: GOTCHA in Ubuntu - broken shell)

Ben Scott dragonhawk at gmail.com
Mon Oct 1 13:37:45 EDT 2007


On 10/1/07, Flaherty, Patrick <pflaherty at wsi.com> wrote:
>> FYI, the correct operator is = and == is an extension of bash. ==
>> should not be used.
>
> I thought everything in those brackets was just an argument to test.

  It is.  Sort of.  Except that /usr/bin/test -- and it's alias,
/usr/bin/[ -- is also a shell built-in for many shells, bash among
them.  So if you're running bash, you're not using /usr/bin/test,
you're using a bash feature.

  In the original Bourne shell, a lot of things which are shell
built-in's were external programs.  Those include test, [, echo,
which, kill, and pwd.  (This is not an exhaustive list.)

  In bash, you can use the "enable" built-in to list and control
built-in commands.  (To really mess things up, try "enable -n enable",
which disables the "enable" command.  ;-)  )

-- Ben


More information about the gnhlug-discuss mailing list