1 2 3 4 5 6 7 8
#!/bin/bash foo='bar baz' sedreg="'sed s/toReplace/$foo/g'" sed -i ${sedreg} /testfile exit $?