• Uncategorized

About linux : How-to-bypass-IncrediBuild-console-if-not-installed

Question Detail

There are some bash scripts running on our build machines where IncrediBuild is installed. The idea of IncrediBuild is to utilize all cores available in the network to speed up the build process.

Example shell script:

...
ib_console cmake --build .

The shell script shall not be changed. I would like to run the script on machines without ib_console. Is there a possibility to somehow simulate it or forward the call to cmake ?

Question Answer

Place this into your .bashrc file:

if [ ! -f ┬┤whereis ib_console┬┤ ] then
    alias ib_console='[email protected]'
fi

Explanation:

  • -f checks, whether the ib_console binary exists
  • [email protected] take all arguments into one single string (they are then executed standalone)

@alex: the alias works from the shell but not in the shell script above since aliases are not expanded in non interactive shell scripts.

With Why doesn’t my Bash script recognize aliases? I could fix it.

if ! [ -f 'whereis ib_console' ]; then
    ib_console()
    {
        echo "ib_console dummy: run '[email protected]'..."
        [email protected]
        echo "ib_console dummy: done"
    }
    export -f ib_console
fi

It is recommended to run ‘exec bash’ after updating .bashrc

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.