代码之家  ›  专栏  ›  技术社区  ›  Werner

如果未安装,如何绕过Incredbuild控制台?

  •  1
  • Werner  · 技术社区  · 6 年前

    有一些bash脚本在安装了credituild的构建机器上运行。IncrediBuild的思想是利用网络中可用的所有核心来加速构建过程。

    示例shell脚本:

    ...
    ib_console cmake --build .
    

    外壳脚本不得更改。我想在没有ib\u控制台的机器上运行脚本。是否有可能以某种方式模拟它或将调用转发给cmake?

    2 回复  |  直到 6 年前
        1
  •  3
  •   ulmer-a    6 年前

    将此放入 .bashrc 文件:

    if [ ! -f ´whereis ib_console´ ] then
        alias ib_console='$@'
    fi
    

    说明:

    • -f级 检查ib\U控制台二进制文件是否存在
    • $@ 将所有参数放入一个字符串中(然后独立执行)
        2
  •  2
  •   Werner    6 年前

    @alex:别名在shell中工作,但在上面的shell脚本中不工作,因为别名在非交互式shell脚本中不会展开。

    具有 Why doesn't my Bash script recognize aliases? 我可以修好它。

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

    建议在更新后运行“exec bash”。bashrc公司