Shell 脚本如下:
#!/bin/bash
main()
{
if [ $# -ne 1 ];
then
echo -e '请在命令后面加上项目名称'
return;
fi
cd /home/git/gitRepo
git init --bare ${respName}.git
chown -R git:git ${respName}.git
chmod go-wrx ${respName}.git
cd ~
}
respName=$1
alias ..='cd ..'
curdate=`date '+%Y%m%d'`
#execute main function
main $@
. 脚本文件名 仓库名称
例如: . initResp test
就会创建test.git的仓库