如果未安装,如何绕过 IncrediBuild 控制台?
How to bypass IncrediBuild console if not installed?
有一些 bash 脚本 运行 在我们安装了 IncrediBuild 的构建机器上。 IncrediBuild 的理念是利用网络中所有可用的内核来加速构建过程。
示例 shell 脚本:
...
ib_console cmake --build .
shell 脚本不得更改。我想 运行 没有 ib_console 的机器上的脚本。是否有可能以某种方式模拟它或将调用转发给 cmake?
将此放入您的 .bashrc
文件中:
if [ ! -f ´whereis ib_console´ ] then
alias ib_console='$@'
fi
解释:
- -f 检查 ib_console 二进制文件是否存在
- $@ 将所有参数放入一个字符串中(然后独立执行)
@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
更新.bashrc后建议运行'exec bash'
有一些 bash 脚本 运行 在我们安装了 IncrediBuild 的构建机器上。 IncrediBuild 的理念是利用网络中所有可用的内核来加速构建过程。
示例 shell 脚本:
...
ib_console cmake --build .
shell 脚本不得更改。我想 运行 没有 ib_console 的机器上的脚本。是否有可能以某种方式模拟它或将调用转发给 cmake?
将此放入您的 .bashrc
文件中:
if [ ! -f ´whereis ib_console´ ] then
alias ib_console='$@'
fi
解释:
- -f 检查 ib_console 二进制文件是否存在
- $@ 将所有参数放入一个字符串中(然后独立执行)
@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
更新.bashrc后建议运行'exec bash'