Skip to content

Instantly share code, notes, and snippets.

@5470x3
Created July 4, 2015 21:28
Show Gist options
  • Save 5470x3/8f487979dced025e056f to your computer and use it in GitHub Desktop.
Save 5470x3/8f487979dced025e056f to your computer and use it in GitHub Desktop.
post-updateをコピーして宛先をsedで置換するだけのシェルスクリプト
#!/bin/bash
REPOS=("accounts" "search" "core" "lightbox" "tool")
REPOS_PATH="/home/git/repositories/dev/"
REF="${REPOS_PATH}refference.git/hooks/post-update"
for REPO in ${REPOS[@]}
do
echo $REPO
cp ${REF} ${REPOS_PATH}${REPO}.git/hooks/
sed -i -e "s/refference/${REPO}.git/g" ${REPOS_PATH}${REPO}.git/hooks/post-update
# 1回目コピーしたらpiyo.git.gitになってしまったので
# sed -i -e "s/.git.git/.git/g" ${REPOS_PATH}${REPO}.git/hooks/post-update
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment