Viraj Alankar wrote: > ... > /dev/sda2 /tmp ext3 > defaults,nosuid,nodev,noexec 1 2 > ... > > I would like to remove ',noexec' from this line only. I thought of > using LocateLineMatching to find the line, but am not sure how to do > the replacement.
Here is a very careful way to do it, though it requires that you know the entire form of the line you want to end up with. control: fstab_line = ( "/dev/sda2 /tmp ext3 defaults,nosuid,nodev 1 2" ) editfiles: { /etc/fstab AppendIfNoSuchLine "${fstab_line}" ResetSearch "1" LocateLineMatching "^/dev/sda2.*$" BeginGroupIfNoMatch "^${fstab_line}$" ReplaceLineWith "${fstab_line}" EndGroup DeleteLinesAfterThisMatching "^/dev/sda2.*$" CatchAbort } Best, Brendan -- Senior System Administrator The University of Chicago Department of Computer Science http://www.cs.uchicago.edu/people/brendan _______________________________________________ Help-cfengine mailing list Help-cfengine@gnu.org http://lists.gnu.org/mailman/listinfo/help-cfengine