setconf(1) setconf(1)

setconf - change settings in configuration textfiles

setconf filename key value [end string for a multiline value]

If there's a textfile with fields like these:

CC=gcc

lights := on

compileToday: true

anumber = 42

cabal ==1.2.3

Setconf can change the values to something else. The value related to the first key found will be changed to the given value.

For example, CC is a key and gcc is a value.

setconf
Exits with error code 1

setconf Makefile.defaults NETSURF_USE_HARU_PDF NO
In Makefile.defaults, set NETSURF_USE_HARU_PDF to NO

setconf Makefile CC gcc
Sets CC=gcc in Makefile

setconf PKGBUILD sha256sums "('123abc' 'abc123')" ')'
In the PKGBUILD file, set the value for the sha256sums keys to
('123abc' 'abc123') regardless of how many lines the previous value
spans, since the end string ')' is given.

setconf app.py NUMS "[1, 2, 3]" ']'
Multiline replacement, replacing the text from the value belonging
to the key NUMS to the endstring ] with the value [1, 2, 3],
regardless of how many lines the previous value spans.

setconf my.conf x=1
Sets x to 1 in my.conf, even if my.conf uses a different assignment,
like x := 42, x : 42, x == 42, x :: 42 or x => 42.

setconf -a server.ini 'Z => 99'
Adds Z => 99 to server.ini

setconf --add rolling.conf N 1000
Adds N=1000. Creates the file if needed.

setconf test.file y-=0.1
Decreases y with 0.1.

setconf values.conf x+=2
Increases x with 2.

setconf -d linux/printk.h CONSOLE_LOGLEVEL_DEFAULT=4
Changes #define CONSOLE_LOGLEVEL_DEFAULT to 4

setconf -u kernel_config CONFIG_ULTRIX_PARTITION=y
Uncomment and set CONFIG_ULTRIX_PARTITION=y, even if the original
value is suffixed by "is not set". Intended for use with Linux kernel
configuration.

displays the current version number
displays brief usage information
performs internal self testing
adds an option, if not already present. Must be followed by a filename and a key/value pair.
changes a single-line #define value
uncomments a key before changing the value

Aims to solve a tiny problem properly instead of a thousand problems halfway, in true UNIX-spirit

Creates a line that is very easy to read, as opposed to using sed for the same task

It should be clear from the syntax what is being done

Only one small executable, not a big package

sed(1) make(1)

Only unknown bugs so far. Bugs can be reported at https://github.com/xyproto/setconf/issues.

0.7.7

setconf was written by Alexander F. Rødseth <xyproto@archlinux.org> + contributors

06 Jul 2020