Gentoo Archives: gentoo-user

From: Michael Mol <mikemol@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] "/usr/bin/[" and coreutils
Date: Thu, 13 Oct 2011 14:03:00
Message-Id: CA+czFiABDc6yh6=LBRn3n23b8VWBLDjTSfubX_a6=r1Nksku3A@mail.gmail.com
In Reply to: Re: [gentoo-user] "/usr/bin/[" and coreutils by Alan McKinnon
1 On Thu, Oct 13, 2011 at 9:50 AM, Alan McKinnon <alan.mckinnon@×××××.com> wrote:
2 > On Thu, 13 Oct 2011 15:38:08 +0200
3 > Jesús J. Guerrero Botella <jesus.guerrero.botella@×××××.com> wrote:
4 >
5 >> Yes, it's a different binary, and it's perfectly usual to find it in a
6 >> Linux system.
7 >>
8 >> But note that, at least in bash, you rarely will be using /usr/bin/[
9 >> unless you reference it using the full path (either in a relative or
10 >> absolute way). This is because bash has a builtin that takes over that
11 >> binary file. You can check that (or any other command) by using the
12 >> "type" instruction (again, this is for bash).
13 >>
14 >> # LC_ALL=C type [
15 >> [ is a shell builtin
16 >>
17 >> The same goes for 'test'.
18 >>
19 >> Those binaries are probably there just in case that some init or
20 >> system script written for a standard bourne shell (like the busybox
21 >> one) needs it. But don't take my word for it. I am not sure right now.
22 >
23 > You might not be sure, but that doesn't stop you still being correct :-)
24 >
25 > The binaries are usually POSIX-compliant, whereas the builtins may
26 > include extra bashisms (which tend to break apps expecting just
27 > the basic POSIX behaviour)
28
29 I haven't encountered POSIX-dependent apps breaking on bash, but I
30 have encountered the reverse. My most annoying experience was when I
31 tried building cinelerra on Debian a few years back. Cinelerra's
32 script started with #!/bin/sh, but depended on bashisms--and I was
33 running dash.
34
35 --
36 :wq

Replies

Subject Author
Re: [gentoo-user] "/usr/bin/[" and coreutils Alan McKinnon <alan.mckinnon@×××××.com>