[augeas-devel] Remove a value from an array with augtool?
Raphaël Pinson
raphink at gmail.com
Sat Nov 24 07:19:05 UTC 2012
Hello,
On Sat, Nov 24, 2012 at 2:43 AM, Graham Leggett <minfrin at sharp.fm> wrote:
> Hi all,
>
> I am trying to edit a postfix main.cf with with augtool, and am
> struggling with arrays.
>
> I can add a particular value to a given array with the set command, for
> example like this:
>
> augtool> set /files/etc/postfix/main.cf/virtual_alias_maps[last()] my-map
>
This will set the last element, even if it already exists. If you want to
add an element to the array, you should use:
set /files/etc/postfix/main.cf/virtual_alias_maps[last()+1] my-map
Note that this operation is not idempotent, it will add a new entry every
time you run it.
>
> I am struggling with the syntax to remove this value "my-map" again:
>
> augtool> rm [what-goes-here?]
>
If you want to remove all virtual_alias_maps values, simply use:
rm /files/etc/postfix/main.cf/virtual_alias_maps
If you only want to remove the last value:
rm /files/etc/postfix/main.cf/virtual_alias_maps[last()]
Cheers,
Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20121124/bcd5b264/attachment.htm>
More information about the augeas-devel
mailing list