我写一个后收到GIT脚本钩/后得到:语法错误:“(”意外(预期“完成”)
我附上一个最小版本的话,这也将失败。
generate_email()
{
for user in $(git config --get-all notifications.users); do
unset files_to_notify
for filter in $(git config --get-all notifications.$user); do
files_to_notify=" $files_to_notify $(git diff-tree --no-commit-id \
--name-only -r $newrev | grep $filter) "
done
files_to_notify=($files_to_notify)
if [ -n "$files_to_notify" ]; then
echo ${files_to_notify[*]}
fi
done
}
while read oldrev newrev refname
do
generate_email $oldrev $newrev $refname
done
当我试图推到git的服务器在调用此脚本,我得到以下信息:
远程:钩/后得到:10:钩/ - 接收后:语法错误:“(”意外(期待“完成”)
当我尝试在命令行中运行它时,脚本无需此消息即可正常运行。
任何想法?
感谢,
Elyashiv
什么'files_to_notify =($ files_to_notify)'应该做什么? – VonC 2013-02-11 08:48:13