Skip to content

Instantly share code, notes, and snippets.

@ruanjf
Last active September 25, 2017 13:34
Show Gist options
  • Save ruanjf/54a26b18ed00a837c2f5c9bcd2848223 to your computer and use it in GitHub Desktop.
Save ruanjf/54a26b18ed00a837c2f5c9bcd2848223 to your computer and use it in GitHub Desktop.
git逐个文件夹,提取名称替换变量并提交
# 逐个文件夹,提取名称替换变量并提交
for f in docker-*/; do
cd $f
echo ''
echo ''
echo $PWD
APP_PKG=`echo service-*.jar`
APP_NAME=`echo $APP_PKG | sed -E "s/(.+)-([0-9]+.*)\.jar/\1/g"`
APP_VERSION=`echo $APP_PKG | sed -E "s/(.+)-([0-9]+.*)\.jar/\2/g"`
cp Dockerfile_template Dockerfile
sed -i "s/\${APP_PKG}/${APP_PKG}/g" Dockerfile
sed -i "s/\${APP_NAME}/${APP_NAME}/g" Dockerfile
sed -i "s/\${APP_VERSION}/${APP_VERSION}/g" Dockerfile
git add .
git commit -am update
git push
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment