1

我正在尝试使这个小脚本工作,但我错过了一些东西..

exclude=""
while read line
do
    exclude+="--exclude $line "
done < exclude.ini
echo "$exclude"
"rsync -rvi --delete $exclude /var/www/$1 /var/export"

该脚本正在读取需要从文件中排除的文件,但我无法正确连接这些字符串

文件中的条目是这样写的 .svn _svn .htaccess ReadAndDeleteMe.ini cache/* documentation

任何人都可以帮忙吗?

4

1 回答 1

1

我会用

--exclude-from=exclude.ini

事实上,手册页说:

   --exclude-from=FILE
          This option is related to the --exclude option, but it specifies
          a FILE that contains exclude patterns  (one  per  line).   Blank
          lines  in  the  file  and  lines  starting  with  ’;’ or ’#’ are
          ignored.  If FILE is -, the list  will  be  read  from  standard
          input.
于 2013-04-10T16:47:13.647 回答