Sed gives: sed: can't read : No such file or directory

后端 未结 2 1828
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 18:01

I have the following bash script which repeats for each image found. It needs to iterated over all html, css and js files, and replac

2条回答
  •  感情败类
    2020-12-13 18:18

    For support on both OSX and Linux, I use a simple if check to see if the bash script is running on OSX or Linux, and adjust the command's -i argument based on that.

    if [[ "$OSTYPE" == "darwin"* ]]; then
      sed -i '' -e 's|$iconPath|images-theme-dark/$iconfile|g' "{}"
    else
      sed -i -e 's|$iconPath|images-theme-dark/$iconfile|g' "{}"
    fi
    

提交回复
热议问题