Re: Automatic password changing
On Thu, Mar 23, 2000 at 03:42:31PM +0000, Martyn Pearce wrote:
>
> Tim Haynes writes:
> | Not quite. It seems to ignore the filename on the end of the #! line, and
> | you forgot my mod to make it do the right thing re: 'rest of line' :
> |
> | #!/usr/bin/perl -npi.bak
> |
> | s/^root:[^:]*:(.*)$/root:pants:\1/o
>
> That should be $1 in the replacement. \1 works for now only for backwards
> compatibility, and not always even then. Use $1. But you shouldn't need
> the capture-replace at all:
Hmmm, it's been that way for a while ;)
> /^root:[^:]*:/root:pants:/
>
> The /o doesn't get you anything here, since you're not interpolating any
> vars.
My first attempt was exactly that (well unless I've misunderstood something
about the lack of 's/'); it messes up the end of line, basically everything
beyond the bit the LHS matches. Hence the above amendment after some testing.
This might be a 5.005_03 problem, of course.
~Tim
--
| Geek Code: GCS dpu s-:+ a-- C++++ UBLUAVHSC++++ P+++ L++ E--- W+++(--) N++
| w--- O- M-- V-- PS PGP++ t--- X+(-) b D+ G e++(*) h++(*) r--- y-
| The sun is melting over the hills, | http://piglet.is.dreaming.org/
| All our roads are waiting / To be revealed | piglet@glutinous.custard.org
Reply to: