vMX

Expand all | Collapse all

./vmx.sh: 460: [: ubuntu: unexpected operator

Jump to Best Answer
  • 1.  ./vmx.sh: 460: [: ubuntu: unexpected operator

    Posted 07-18-2018 09:39

    Hi

     

    Ubuntu: ubuntu-14.04.1-server-amd64

    vMX: vmx-bundle-17.3R2.10

     

    I have installed vMX on Ubuntu following this guide and I'm using all the recommended package versions:

    https://www.juniper.net/documentation/en_US/vmx17.3/information-products/pathway-pages/getting-started/getting-started.html

     

    Everything seems to work fine and the vMX is up and running but whenever I run the "vmx.sh" script it always comes with an error like this:

     

    # ./vmx.sh --status
    ./vmx.sh: 460: [: ubuntu: unexpected operator
    ==================================================
        Welcome to VMX
    ==================================================

    ...

     

    or

     

    # ./vmx.sh -lv --install
    ./vmx.sh: 460: [: ubuntu: unexpected operator
    ==================================================

        Welcome to VMX
    ==================================================

    ...

     

    I don't understand why the "./vmx.sh" script is a "#!/bin/sh" script when sh (dash) don't understand "[". There must be a lot of "if" checks that doesn't work?

     

    Cheers,

    Martin



  • 2.  RE: ./vmx.sh: 460: [: ubuntu: unexpected operator
    Best Answer

    Posted 07-20-2018 01:15

    The solution must be just to change "/bin/sh" to user bash instead the default of dash in Ubuntu 14.04.1 LTS.

     

    Like this:

    ----

    # ll /bin/sh
    lrwxrwxrwx 1 root root 4 Jun 28 15:54 /bin/sh -> dash*

    # cd /bin
    # rm sh
    # ln -s bash sh

    # ll /bin/sh
    lrwxrwxrwx 1 root root 4 Jul 20 02:37 /bin/sh -> bash*

    ----

     

    Cheers,

    Martin