elixir-boilerplate
elixir-boilerplate copied to clipboard
boilerplate-setup.sh Linux limitation
Sed on MacOS and Linux behave a tiny bit different. -i '' works on MacOS, but will fail on Linux.
An example resolution that I'll paste-in-place here:
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
Source: https://stackoverflow.com/a/57766728
Based on the difference a viable solution might be to proxy the call to sed:
if [[ "$OSTYPE" == "darwin"* ]]; then
sed_command = sed -i ''
else
sed_command = sed -i
fi