chickadee » augeas » aug-set-multiple!

aug-set-multiple! a base sub valueprocedure

Sets the value of multiple nodes in one operation. Finds or creates a node matching SUB by interpreting SUB as a path expression relative to each node matching BASE. SUB may be #f, in which case all the nodes matching BASE will be modified.

Returns the integer number of modified nodes on success, or raises an error on failure.


;; Add node test="foo" to all host entries that are not comments.
(aug-match a "/files/etc/hosts/*[label() != '#comment']")
 ;=> ("/files/etc/hosts/1" "/files/etc/hosts/2")
(aug-print a "/files/etc/hosts/*/test")
(aug-set-multiple! a "/files/etc/hosts/*[label() != '#comment']"
                     "test" "foo")
(aug-print a "/files/etc/hosts/*/test")
 ;; /files/etc/hosts/1/test = "foo"
 ;; /files/etc/hosts/2/test = "foo"