'/usr/bin/[' (was RE: FC12: Hidden files in /usr/bin/*)

Bryn M. Reeves bmr at redhat.com
Mon Jan 25 16:15:23 UTC 2010


On Mon, 2010-01-25 at 16:44 +0100, Andreas Schwab wrote:
> Garrett Holmstrom <gholms at fedoraproject.org> writes:
> 
> > On Mon, Jan 25, 2010 at 6:09 AM, Bryn M. Reeves <bmr at redhat.com> wrote:
> >> It's cute isn't it? I had the biggest grin the day I realised that '['
> >> was just another command..
> >
> > That's the reason [[ can use special characters like < and > without
> > escaping, while [ can't:  [[ is a builtin, but [ isn't.
> 
> Well, [ is a builtin too, but [[ is a keyword recognised by the parser,
> thus it can use special parsing rules.
> 

<nitpick> [ may be a built in but then again (as its presence
in /usr/bin implies) it may not be :). In traditional shells it was a
proper command but is often a builtin these days.

[[..]] are one of the syntactic elements the bash provides for building
compound commands.

Regards,
Bryn.





More information about the devel mailing list