我正在尝试为此处提到的 bash 脚本编写一个 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" myemail@myserver.com
endif
这是我得到的错误
$ ./scr
if: Badly formed number.
$
这个页面提到“C-shell中的数字必须是整数”,所以我尝试了
set now=`date +%Y%m%d%H%M`
但我仍然得到同样的错误。