我试图在目录内循环并使用空格重命名文件名。但是我在使用sh test.sh运行它时遇到了错误的替换错误
#!/bin/bash
for f in /home/admin1/abc/*.kmz
do
mv "$f" "${f// /_}"
#rm $i
done
由于我需要在crontab中进行配置,因此可能需要使用sh命令而不是./来运行它。
我试图在目录内循环并使用空格重命名文件名。但是我在使用sh test.sh运行它时遇到了错误的替换错误
#!/bin/bash
for f in /home/admin1/abc/*.kmz
do
mv "$f" "${f// /_}"
#rm $i
done
由于我需要在crontab中进行配置,因此可能需要使用sh命令而不是./来运行它。
Bourne Shell
sh
doesn't support this type of substitution. You could run this script: