1 |
Am Tue, 11 Oct 2011 22:42:00 -0700
|
2 |
schrieb Canek Peláez Valdés <caneko@×××××.com>:
|
3 |
|
4 |
> On Tue, Oct 11, 2011 at 10:35 PM, William Kenworthy |
5 |
> <billk@×××××××××.au> wrote: |
6 |
> > I have been checking my system for some deep seated problems and in |
7 |
> > the process, ran across the fact that "equery files |
8 |
> > sys-apps/coreutils-8.7" shows a file included called "/usr/bin/[" - |
9 |
> > thats right, left square bracket! |
10 |
> > |
11 |
> > Is that a bug or if real, what would you use it for? It doesnt |
12 |
> > seem to be on the file system ... |
13 |
> > |
14 |
> > moriah ~ # /usr/bin/[ |
15 |
> > /usr/bin/[: missing `]' |
16 |
> > moriah ~ # |
17 |
> > |
18 |
> > doesnt show much! |
19 |
> |
20 |
> Relax. It's an alias for "test" |
21 |
|
22 |
technically it's not an alias, but different binaries
|
23 |
|
24 |
% ls -l /usr/bin/\[
|
25 |
-rwxr-xr-x 1 root root 35096 Jan 20 2011 /usr/bin/[
|
26 |
% ls -l /usr/bin/test
|
27 |
-rwxr-xr-x 1 root root 31000 Jan 20 2011 /usr/bin/test
|
28 |
|
29 |
built from the same source file coreutils/src/test.c with a
|
30 |
#define LBRACKET
|
31 |
that mainly changes the behavior of the argument parser in case it is
|
32 |
built as [.
|
33 |
|
34 |
|
35 |
>, so instead of using |
36 |
> |
37 |
> if test blah; then |
38 |
> ... |
39 |
> fi |
40 |
> |
41 |
> in bash, you can use |
42 |
> |
43 |
> if [ blah ]; then |
44 |
> ... |
45 |
> fi |
46 |
> |
47 |
> Just do /usr/bin/[ --help to get an idea. It has been there since I |
48 |
> started using Linux, if I remember correctly, many years ago. |
49 |
> |
50 |
> Regards. |