我有以下内容 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:无法读取:没有这样的文件或目录 但我已经有了引用 {}
当我回应 sed
命令并在命令行上手动执行它没有错误。
我在Raspbian GNU / Linux 8.0(jessie)上使用GNU sed v4.2.2
有人看到这里可能有什么问题吗?