我尝试了以下shell脚本,该脚本应该替换所有xml文件名中的空格
for xml_file in $(find $1 -name "* .xml" -type f);
do
echo "removing spaces from XML file:" $xml_file
mv "$xml_file" "${xml_file// /_}";
done
假设我有一个名为的xml文件xy z.xml
,那么它给出了:
removing spaces from XML file: /home/krishna/test/xy
mv: cannot stat `/home/krishna/test/xy': No such file or directory
removing spaces from XML file: .xml
mv: cannot stat `z.xml': No such file or directory