Thread (2 messages) flat view 2 messages, 2 authors, 2016-08-11

Re: Diffs from CVS keyword expansion

From: Junio C Hamano <hidden>
Date: 2016-08-11 19:34:19

merlyn@stonehenge.com (Randal L. Schwartz) writes:
quoted
quoted
quoted
quoted
quoted
"Uwe" == Uwe Kleine-Koenig [off-list ref] writes:
Uwe> 	#! /bin/sh
Uwe> 	exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@";

Ow.  My eyes hurt from that.  How about we rewrite that as a native Perl
script:

    #!/usr/bin/perl
    $^I = ""; # this is -i
    while (<>) {
      s/\$(Id|Revision):.*?\$/\$$1: \$/;
      print;
    }
That's kinda surprising coming from the resident Perl guru.

I am so used to the command line "-i -p" that I did not even
know what $^I does, and I would have lost without your "# this
is -i" comment.  That alone makes the Uwe's one more readable
for me ;-).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help