Your problem is that you're nesting quoting mechanisms (delimiters) when you shouldn't.
Generally, you should use single quotes to enclose an sed
script as a whole:
sed -i '' -e 's/curl -L/curl -k -L/g' install*
By using single quotes, the script is protected from accidental interpretation by the shell.
If you do want the shell to interpret parts of a sed
script beforehand, splice those parts in as double-quoted strings.
To sed
's s
function, it is /
that acts as the delimiter - no additional quoting of the strings between /
instances should be used, and your use of '
simply causes sed
to consider these single quotes part of the regex to match / the replacement string. (As an aside: you're free to choose a delimiter other than /
).
That said, if you do need to force interpretation of certain characters as literals, use \
-escaping, such as using \.
in the regex to represent a literal .
This is the only quoting mechanism that sed
itself supports.
However, in your particular case, neither the string used in the regex nor the string used as the replacement string need escaping.
For a generic way to escape strings for use as literals in these situations, see
https://stackoverflow.com/a/29613573/45375.