【发布时间】:2016-11-15 00:13:03
【问题描述】:
简单的 shell 脚本问题。在 BB 中设置管道,我要移植的工作之一是通过一些 grunt 命令增加凉亭版本。我把它分解成单独的工作,这样它就不会自动运行,因为它会碰撞包,并提交回 repo。所以我想做的是当任务开始时,运行 git log 命令,检查最后的提交消息,如果它与预定义的消息匹配,然后退出。否则继续。如何检查最新的 git commit 消息并在 bash 中运行 if else check?
#! /bin/bash
git log -1
if git log -1 === "pre-defined message";
then
echo "already pushed and bumped exiting"
exit 1
else
echo "not bumped -- continuing job"
./setup-git.sh
fi
【问题讨论】:
-
问题是什么?
-
如果我能够读取 git log last commit 消息并运行 if else bash 中的语句。我是,但我的 JavaScript 头脑需要更多地了解 shell 脚本。 :)
标签: git shell bitbucket-pipelines