2013-03-01 80 views
-1

我正在設置一個腳本,將svn add所有新的非顛覆文件轉換爲subversion,然後執行提交。在bash腳本中查找「缺少參數」錯誤

#!/bin/bash 
find /path/to/uploads -type f -mmin -5 -not -iwholename 
'*.svn*'|xargs -r /usr/bin/svn add 
sleep 2 
/usr/bin/svn commit /path/to/uploads -m auto_upload 

當我運行這個從殼我得到:

find: missing argument to `-iwholename' 
upload_images.sh: line 3: *.svn*: command not found 

我需要跳脫出星號什麼的?我很困惑。我在這裏做錯了什麼?

+0

當我沒有正確地用'''\'''結尾時,用** - exec **看到這個錯誤 – 2016-06-21 17:09:14

回答

5

您的find命令中間有一個換行符。這將導致bash將其解釋爲兩個單獨的命令。要麼使之成爲單行:

find /path/to/uploads -type f -mmin -5 -not -iwholename '*.svn*'|xargs -r /usr/bin/svn add 

或使用\繼續吧:

find /path/to/uploads -type f -mmin -5 -not -iwholename \ 
'*.svn*'|xargs -r /usr/bin/svn add 

聽起來也許副本+粘貼錯誤。