有修改内容时,可以按 y 继续执行

This commit is contained in:
liaoxuezhi 2019-06-28 10:11:06 +08:00
parent 2ad1d5d3b9
commit 63cbffbe6a
1 changed files with 7 additions and 2 deletions

View File

@ -6,8 +6,13 @@ if [ -z "$(git status --porcelain)" ]; then
echo "Working directory clean" echo "Working directory clean"
else else
# Uncommitted changes # Uncommitted changes
echo "Skiped: You got uncommitted changes" read -p "You got uncommitted changes, press y to continue? " -n 1 -r
exit echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Skiped!"
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
fi fi
rm -rf gh-pages rm -rf gh-pages