在安装了 IncrediBuild 的构建机器上运行了一些 bash 脚本。IncrediBuild 的想法是利用网络中所有可用的内核来加速构建过程。
示例外壳脚本:
...
ib_console cmake --build .
不得更改 shell 脚本。我想在没有 ib_console 的机器上运行脚本。是否有可能以某种方式模拟它或将呼叫转发给 cmake ?
在安装了 IncrediBuild 的构建机器上运行了一些 bash 脚本。IncrediBuild 的想法是利用网络中所有可用的内核来加速构建过程。
示例外壳脚本:
...
ib_console cmake --build .
不得更改 shell 脚本。我想在没有 ib_console 的机器上运行脚本。是否有可能以某种方式模拟它或将呼叫转发给 cmake ?
将其放入您的.bashrc
文件中:
if [ ! -f ´whereis ib_console´ ] then
alias ib_console='$@'
fi
解释:
@alex:别名在 shell 中起作用,但在上面的 shell 脚本中不起作用,因为在非交互式 shell 脚本中没有扩展别名。
为什么我的 Bash 脚本不能识别别名?我可以修复它。
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'