Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Odd Program in /usr/bin

  1. #1
    Join Date
    Feb 2009
    Location
    Finland
    Posts
    211

    Default Odd Program in /usr/bin

    Hi,

    I have 11.2 installed, 32 bit, from the DVD.

    I see that there is this
    Code:
    -rwxr-xr-x  1 root  root       34564 2009-10-24 07:20 [
    in /usr/bin.

    The command "file" says that it is
    Code:
    [: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.4, stripped
    Anybody know what this is?

  2. #2

    Default Re: Odd Program in /usr/bin

    It's fine to check see what owns it it should be coreutils or something like so, very basic and needed.
    think..
    Code:
    rpm -qf /usr/bin/[
    Info Bash Reference Manual scroll down but it is a form of test.
    Man first, have a try at Info, have a look at Wiki, if all that fails Scroogle!!!!!
    If I've helped click on the Rep button I don't know what it does but it sounds cool.

  3. #3
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Odd Program in /usr/bin

    It's a synonym for test.

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,367

    Default Re: Odd Program in /usr/bin

    Strange enough (to me):
    Code:
    henk@boven:/usr/bin> l test [
    -rwxr-xr-x 1 root root 34564 okt 24  2009 [*
    -rwxr-xr-x 1 root root 30464 okt 24  2009 test*
    henk@boven:/usr/bin>
    one of them is not a symbolic link to the other and their sizes are not equal.

    Which iswhen you look at vi and friends:
    Code:
    henk@boven:/usr/bin> ls -l|grep vim
    lrwxrwxrwx 1 root root           3 jan  2 20:02 edit -> vim
    lrwxrwxrwx 1 root root           3 jan  2 20:02 ex -> vim
    -rwxr-xr-x 1 root root         143 okt 24  2009 gvimtutor
    lrwxrwxrwx 1 root root           3 jan  2 20:02 rview -> vim
    lrwxrwxrwx 1 root root           3 jan  2 20:02 rvim -> vim
    lrwxrwxrwx 1 root root           8 jan  2 20:02 vi -> /bin/vim
    lrwxrwxrwx 1 root root           3 jan  2 20:02 view -> vim
    lrwxrwxrwx 1 root root           8 jan  2 20:02 vim -> /bin/vim
    lrwxrwxrwx 1 root root           3 jan  2 20:02 vimdiff -> vim
    -rwxr-xr-x 1 root root        2050 okt 24  2009 vimtutor
    henk@boven:/usr/bin>
    Henk van Velden

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Odd Program in /usr/bin

    Yes, I noticed that too, they used to be the same program in classic Unix. Not sure why the binutils devs decided to make them separate programs. When [ is invoked, it requires the last argument to be ]. However a combined program could easily tell which name it was called by looking at argv[0] and behave accordingly.

  6. #6

    Default Re: Odd Program in /usr/bin

    I'm glad you raised that I'm sure me and Ken had a similar one not so long ago that showed it linking. Thought I'd imagined it..

    Ahh here it is not so long ago either the special "test" expression `-l STRING' - openSUSE Forums
    Man first, have a try at Info, have a look at Wiki, if all that fails Scroogle!!!!!
    If I've helped click on the Rep button I don't know what it does but it sounds cool.

  7. #7
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Odd Program in /usr/bin

    antttikutoja wrote:
    > -rwxr-xr-x 1 root root 34564 2009-10-24 07:20 [


    man [ :-)

    --
    DenverD (Linux Counter 282315)
    CAVEAT: http://is.gd/bpoMD
    posted via NNTP w/TBird 2.0.0.23 | KDE 3.5.7 | openSUSE 10.3
    2.6.22.19-0.4-default SMP i686
    AMD Athlon 1 GB RAM | GeForce FX 5500 | ASRock K8Upgrade-760GX |
    CMedia 9761 AC'97 Audio

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,367

    Default Re: Odd Program in /usr/bin

    Quote Originally Posted by FeatherMonkey View Post
    I'm glad you raised that I'm sure me and Ken had a similar one not so long ago that showed it linking. Thought I'd imagined it..

    Ahh here it is not so long ago either the special "test" expression `-l STRING' - openSUSE Forums
    Looking at that post you see that [ is a link to test as ken_yap and I expected it to be. That must be a different openSUSE I suppose.

    When you look at the man page of test, you will find it is about test and [.

    Also it might be of interest to know that in most shells (including bash) the [ program is not called, but is handled internaly by the interpreter (in most shell scripts there are so many tests done that loading a separate program each time for them was a performance problem).

    And (a bit more remote) I prefer the [[ .. ]] construct (that originated in ksh, but is supported in bash) above the [ program (simulated by bash or not).
    Henk van Velden

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,367

    Default Re: Odd Program in /usr/bin

    Quote Originally Posted by DenverD View Post
    antttikutoja wrote:
    > -rwxr-xr-x 1 root root 34564 2009-10-24 07:20 [


    man [ :-)

    --
    DenverD (Linux Counter 282315)
    CAVEAT: C A V E A T
    posted via NNTP w/TBird 2.0.0.23 | KDE 3.5.7 | openSUSE 10.3
    2.6.22.19-0.4-default SMP i686
    AMD Athlon 1 GB RAM | GeForce FX 5500 | ASRock K8Upgrade-760GX |
    CMedia 9761 AC'97 Audio
    Did that give a man page to you?

    In my system:
    Code:
    henk@boven:~> man [
    Er is geen pagina over [
    henk@boven:~> LANG=C man [
    No manual entry for [
    henk@boven:~>
    Henk van Velden

  10. #10

    Default Re: Odd Program in /usr/bin

    It was 11.2 pretty vanilla too. I expected the same and remembered I had posted it.

    Not checked Suse but also got no man page DenverD is still on an old one, so not always relevant.
    Man first, have a try at Info, have a look at Wiki, if all that fails Scroogle!!!!!
    If I've helped click on the Rep button I don't know what it does but it sounds cool.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •