Re: [PATCH v4 1/4] Makefile: generate Perl header from template file
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Dec 3, 2017, 09:26 UTC
- Message-ID
- <87a7z0upqq.fsf@evledraar.booking.com>
- In-Reply-To
- <xmqqr2scjsb4.fsf@gitster.mtv.corp.google.com>
On Sun, Dec 03 2017, Junio C. Hamano jotted:
Show 24 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes: > >>> + sed -e 's=@@PATHSEP@@=$(pathsep)=g' \ >> >> This doesn't work, unfortunately. When $(pathsep) is ';', we get an >> incomplete sed expression because ';' is also a command separator in >> the sed language. > > It is correct that ';' can be and does get used in place of LF when > writing a script on a single line, but even then, as part of a > string argument to 's' command (and also others), there is no need > to quote ';' or otherwise treat it any specially, as the commands > know what their syntax is (e.g. 's=string=replacement=' after seeing > the first '=' knows that it needs to find one unquoted '=' to find > the end of the first argument, and another to find the end of the > replacement string, and ';' seen during that scanning would not have > any special meaning). > > If your sed is so broken and does not satisfy the above expectation, > t6023 would not work for you, I would gess. > > t/t6023-merge-file.sh:sed -e "s/deerit.\$/deerit;/" -e "s/me;\$/me./" < new5.txt > new6.txt > t/t6023-merge-file.sh:sed -e "s/deerit.\$/deerit,/" -e "s/me;\$/me,/" < new5.txt > new7.txt > t/t6023-merge-file.sh:sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit;/"< new6.txt | tr '%' '\012' > new8.txt
Since this whole thing is guarded by "ifndef NO_PERL" Dan could just be using "perl -pe" here instead of fiddling around with the portability edge cases of sed, e.g.:
perl -pe 's[foo][bar[g' <in >out