我编写了以下代码:
foreach current (`ls $1`)
if (-l $1/$current) then
rm -rf `readlink $1/$current`
rm -f $1/$current
else
rm -rf $1/$current
endif
end
基本上,它会清理目录。我想通过告诉它不要删除哪些内容来使其更智能。我想保留某种“对象”以包含所有不应删除的文件/目录,并每次检查current
是否在该“对象”中存在。用Tcsh做到最好的方法是什么?