If you have characters in your variable which are the same as the delimiter you used to s
, try using another delimiter instead:
sed -i '' "s|iPhone Developer|$PROVPROF|g" CMakelists.txt
Something more rare:
sed -i '' $'s\xFFiPhone Developer\xFF'"$PROVPROF"$'\xFFg' CMakelists.txt
Update:
Also, don't try to store your arguments on a variable. Word splitting would not always work the way you do. This is wrong:
command="sed -i '' 's|iPhone Developer|$PROVPROF|g' CMakelists.txt"
$command
Error message like sed: -e expression #1, char 1: unknown command: `''
would appear. On other sed
s the message may be different.
But you can use an array:
command=(sed -i '' "s|iPhone Developer|$PROVPROF|g" CMakelists.txt)
"${command[@]}"
It's still not commendable though. If you can run it directly, run it directly.