First, the shell part: &&
. That just chains the commands together, so each subsequent line will only be run if the prior one is run successfully.
sed -i
means "run these commands inline on the file", that is, modify the file directly instead of printing the changed contents to STDOUT. Each sed command here (the string) is a substitute command, which we can tell because the command starts with s
.
Substitute looks for a piece of text in the file, and then replaces it. So the order is always s/needle/replacement/
. See how the first and last lines have those same forward-slashes? That's the traditional delimiter between the command (substitute), the needle to find in the haystack (install_to_$(INSTALL_DEST)
, and the text to replace it with ().
So, the first one looks for the string and deletes it (the empty replacement). The last one looks for @have_mktemp_command@
and replaces it with yes
.
The middle one is a bit weird. See how it starts with s@
instead of s/
? Well, sed will let you use any delimiter you like to separate the needle from the replacement. Since this needle had a /
in it (\./fixinc\.sh
), it made sense to use a different delimiter than /
. It will replace the text ./fixinc.sh
with -c true
.
Last note: Why does the second needle have \.
instead of .
? Well, in a Regular Expression like the needle is (but not used in your example), some characters are magical and do magical fairy dust operations. One of those magic characters is .
. To avoid the magic, we put a \
in front of it, escaping away from the magic. (The magic is "match any character", and we want a literal period. That's why.)