[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

editfiles and pattern matching

From: Ferguson, Steve
Subject: editfiles and pattern matching
Date: Mon, 14 Jul 2003 14:37:56 -0400

I'm starting to think I shouldn't be permitted to use cfengine. :-)

I'm seeing a behavior I don't expect with editfiles and
AppendIfNoLineMatching.  Either I'm expecting the wrong thing or cfengine is
misbehaving.  I suspect the former.

I have a section in editfiles:

    # Ensure cfengine port is declared in /etc/services
    { /etc/services
      SetLine "cfengine 5308/tcp                        # cfengine port"
      AppendIfNoLineMatching "^cfengine"

What I'd expect is that this would only add the line if I had no line
starting with cfengine.  But I keep getting this result when testing:

address@hidden:cfengine# tail -2 /etc/inet/services
sapmsEUQ        3600/tcp                         # SAP Gateway
cfengine        5308/tcp
address@hidden:cfengine# bin/cfagent -q
address@hidden:cfengine# r tail
tail -2 /etc/inet/services
cfengine        5308/tcp
cfengine        5308/tcp                        # cfengine port

I don't want to do a literal match on the entire string, because of course
the comment part is optional, and someone adding a line by hand might forget
it.  I've tried more complex regexes to try and include the '5308/tcp' part,
but the simple case won't ever work the way I expect.  What am I doing


Steve Ferguson
gedas USA, Inc.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]