Setconf is a small
utility that can be used for changing settings in configuration textfiles.
can it do?
If there's a textfile
fields like these:
lights := on
Setconf can change the values to something else. It will take the first
key it finds and change the value.
Setconf can also change values that span over multiple lines, by adding an end string as the last parameter. A typical end string would be ')' or ']'.
You are writing a PKGBUILD
for Arch and wish to change a setting without using sed.
Let's say you want to change CC from abc to gcc and that "CC=gcc make"
doesn't cut it, for some reason.
Then you can use the following command:
setconf Makefile CC gcc
- It aims to solve a tiny problem properly instead of a
thousand problems halfway, in true UNIX-spirit
- It creates a line that is very easy to read, as opposed to
sed for the same task
- There is less redundancy:
- They key does not have to be specified twice
- They old value does not have to be specified
- It should be clear from the syntax what is being done
- It's only one small executable, not a big package
sed -i filename 's/key=oldvalue/key=value/g'
setconf filename key value
Which arguments are supported?
Setconf ordinarily takes a filename, key and a new value for that key.
One can also give an optional end string, for replacing multiline values.
It's also possible to add lines with -a or --add.
See the man page or --help output for more information.
Source code and bug tracker
The source and issue tracker is available at github
git clone git://github.com/xyproto/setconf.git
There are several options:
Alexander Rødseth 2013