我有以下bash脚本,它对找到的每个图像重复。它需要遍历所有html、css和js文件,并替换该文件中所有出现的图像。
for image in app/www/images-theme-dark/*.png
do
echo "installing icon" $image
# extract filename from iconpath
iconfile=$(basename $image)
iconPath="images/"$(basename $image)
# replace paths in all files containing icon paths
find app/www -type f \( -name "*.html" -or -name "*.css" -or -name "*.js" \
-or -name "*.appcache" \) \
-exec sed -i '' -e 's|$iconPath|images-theme-dark/$iconfile|g' "{}" \;
done
但是,当我运行脚本时sed:
sed: can't read : No such file or directory
在 StackOverflow 上我发现sed: can't read : No such file or directory但我已经引用了{}
当我回显sed命令并在命令行上手动执行它时,没有错误。
我在 Raspbian GNU/Linux 8.0 (jessie) 上使用 GNU sed v4.2.2
有人看到这里可能出了什么问题吗?