On OSX, running sed to edit in place works by passing a zero-length argument like this:
find . -name "*.java" -print | xargs sed -f src/main/scripts/remove_snippets.sed -i ""
However, putting the -i "" into a shell variable does not work:
dashi='-i ""'
find . -name *.java -print | xargs sed -f src/main/scripts/remove_snippets.sed $dashi
Instead of editing in place the "" gets interpreted as a literal string to use for the backup extension, leaving a directory of java files named *.java"".
How can bash be told to interpret the "" as an empty argument rather than an argument containing two double-quotes?
Use an array.