我正在嘗試爲bash腳本mentioned here編寫一個C shell等效腳本。這個C shell腳本有什麼問題?
這是我有:
#! /bin/tcsh
set now=`date +%Y%m%d%H%M.%S`
if ((! -f "./cache") || (-n "`find ./monme -newer ./cache`"))
then
touch cache -t "$now"
echo "new files added" | mail -s "new build" [email protected]
endif
,這是錯誤我得到
$ ./scr
if: Badly formed number.
$
This page提到,「在C殼號必須是整數」,所以我嘗試
set now=`date +%Y%m%d%H%M`
但我仍然得到相同的錯誤。
圓括號和短劃線之間'(-n .....))間距* n *和* then *應該和* if *在同一行上? – t0mm13b 2010-09-11 18:32:33
@ tommieb75:仍然是一樣的錯誤。 ((!-f「./cache」)| – Lazer 2010-09-11 18:34:54
@Lazer:最後一擊......'(-n eval(「'find ./monme -newer ./cache \'」)))' – t0mm13b 2010-09-11 18:36:50