我寫了shell腳本,我試圖把這個腳本作爲客戶端鉤子腳本,但沒有得到腳本引擎哪一個我應該用來運行.sh文件。通常情況下,我已經看到.js文件將被用作SVN的鉤子腳本,不幸的是我不太瞭解jscript,所以請幫助我如何在SVN中添加和運行腳本作爲客戶端鉤腳本。我嘗試過使用WScipt和CScirpt但是它們不適用於我的shell腳本。如何運行shell腳本作爲tortoiseSVN的客戶端鉤腳本?
#!/bin/bash
MAIN_DIR="/cygdrive/e/Trunk/COMMON"
FILE_NAME="/cygdrive/e/Trunk_PRE_COMMIT_HOOK/long_path.txt"
lengthy_path=`find ${MAIN_DIR} -regextype posix-extended -regex '.{500,}'| awk -F'Trunk/' '{print $2}' > ${FILE_NAME}`
if [ -f ${FILE_NAME} ]
then
if [ -s ${FILE_NAME} ]
then
echo -e "\n\n\nSorry the path of a file exceeds 256 charectors, please make it shorten and try commiting again.You can see the path in $FILE_NAME"
else
echo -e "\n\n\nPath is perfect code can be committed..........."
fi
else
echo -e "\n\n\nFile not exists............"
fi
[客戶端掛鉤腳本只有在使用TortoiseSVN時纔有可能](http://stackoverflow.com/a/8490859/1698557),或者[自動包裝/混淆svn命令本身](http:// www.pal-blog.de/entwicklung/perl/better-source-svn-client-side-precommit-hooks.html)。 –
@PatrickQuirk是的,忘了提及我只使用了Tortoise SVN,請讓我知道當開發人員試圖將代碼提交到repo時,哪個腳本引擎需要用來運行.sh腳本。 –
發佈您的腳本。文件擴展名大部分是沒有意義的。 –