Forum: CFEngine Help
Subject: editing a PATH variable
Author: tuibelgium
Link to topic: https://cfengine.com/forum/read.php?3,25365,25365#msg-25365
In a file with the line:
export PATH=$PATH:/bin:/usr/local/bin/:/opt/my_program
I can add /local/my_scripts using this example and it works very well.
bundle agent path {
files:
"/tmp/profile.local"
edit_line => set_path;
}
############################################################
bundle edit_line set_path {
field_edits:
"export\ PATH\=\$PATH\:.*"
edit_field => path(/local/my_scripts,append);
}
However some of our servers have a PATH definition that is split into multiple
lines. f.e.:
export PATH=$PATH:/bin:/usr/local/bin
export PATH=$PATH:/opt/my_program
which results in:
export PATH=$PATH:/bin:/usr/local/bin:/local/my_scripts
export PATH=$PATH:/opt/my_program:/local/my_scripts
Is there a way to force cf-engine to only edit 1 of the lines?
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine