我寫一個後收到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