FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 01-22-2010, 04:06 PM
Fulko Hew
 
Default '/usr/bin/[' (was FC12: Hidden files in /usr/bin/*)

On Fri, Jan 22, 2010 at 11:41 AM, Cleaver, Japheth <jcleaver@soe.sony.com> wrote:




> -----Original Message-----

> From: devel-bounces@lists.fedoraproject.org

> [mailto:devel-bounces@lists.fedoraproject.org] On Behalf Of

> Denis Leroy

> Sent: Friday, January 22, 2010 8:34 AM

> To: Development discussions related to Fedora

> Subject: Re: FC12: Hidden files in /usr/bin/*



*snip*



> Speaking on funny things in /usr/bin

>

> what about '/usr/bin/[', part of cureutils... had never

> noticed this one before.

>

> -denis



Isn't that simply what makes "if [ (blah) ]" work?

Yup!* Thats not a hidden file, just a piece of magic.
Its not hidden, it just _looks_ likes its obfuscated.* :-(






--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 01-25-2010, 11:09 AM
"Bryn M. Reeves"
 
Default '/usr/bin/[' (was FC12: Hidden files in /usr/bin/*)

On Fri, 2010-01-22 at 08:41 -0800, Cleaver, Japheth wrote:
> > Denis Leroy
> > what about '/usr/bin/[', part of cureutils... had never
> > noticed this one before.
> >
> > -denis
>
>
> Isn't that simply what makes "if [ (blah) ]" work?

It's cute isn't it? I had the biggest grin the day I realised that '['
was just another command..

Bryn.


--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 01-25-2010, 02:33 PM
Garrett Holmstrom
 
Default '/usr/bin/[' (was FC12: Hidden files in /usr/bin/*)

On Mon, Jan 25, 2010 at 6:09 AM, Bryn M. Reeves <bmr@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.

--
Garrett Holmstrom
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 01-25-2010, 02:44 PM
Andreas Schwab
 
Default '/usr/bin/[' (was FC12: Hidden files in /usr/bin/*)

Garrett Holmstrom <gholms@fedoraproject.org> writes:

> On Mon, Jan 25, 2010 at 6:09 AM, Bryn M. Reeves <bmr@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.

Andreas.

--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 01-25-2010, 03:15 PM
"Bryn M. Reeves"
 
Default '/usr/bin/[' (was FC12: Hidden files in /usr/bin/*)

On Mon, 2010-01-25 at 16:44 +0100, Andreas Schwab wrote:
> Garrett Holmstrom <gholms@fedoraproject.org> writes:
>
> > On Mon, Jan 25, 2010 at 6:09 AM, Bryn M. Reeves <bmr@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.



--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 01-25-2010, 03:44 PM
Andreas Schwab
 
Default '/usr/bin/[' (was FC12: Hidden files in /usr/bin/*)

"Bryn M. Reeves" <bmr@redhat.com> writes:

> <nitpick> [ may be a built in but then again (as its presence
> in /usr/bin implies) it may not be .

Like any other command.

Andreas.

--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 01-25-2010, 03:53 PM
"Bryn M. Reeves"
 
Default '/usr/bin/[' (was FC12: Hidden files in /usr/bin/*)

On Mon, 2010-01-25 at 17:44 +0100, Andreas Schwab wrote:
> "Bryn M. Reeves" <bmr@redhat.com> writes:
>
> > <nitpick> [ may be a built in but then again (as its presence
> > in /usr/bin implies) it may not be .
>
> Like any other command.

But unlike '[[' which is the point I was replying to. Afaik you can't
provide a '[[' binary and have it mimic the builtin exactly.

Regards,
Bryn.


--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 01-25-2010, 05:00 PM
Andreas Schwab
 
Default '/usr/bin/[' (was FC12: Hidden files in /usr/bin/*)

"Bryn M. Reeves" <bmr@redhat.com> writes:

> On Mon, 2010-01-25 at 17:44 +0100, Andreas Schwab wrote:
>> "Bryn M. Reeves" <bmr@redhat.com> writes:
>>
>> > <nitpick> [ may be a built in but then again (as its presence
>> > in /usr/bin implies) it may not be .
>>
>> Like any other command.
>
> But unlike '[[' which is the point I was replying to. Afaik you can't
> provide a '[[' binary and have it mimic the builtin exactly.

Because [[ is not a command, it is a reserved word, part of the shell
grammar. That is the key difference, not the built-in property.

Andreas.

--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 

Thread Tools




All times are GMT. The time now is 06:46 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org