Page 1 of 1

[Linux] Ini-tweak migration script

Posted: 20 Sep 2017, 18:43
by mupf
I just wrote a little tool for myself. A script to add mod-specific ini-tweaks to the openmw.cfg.
Currently supported mods:

TLM - The Lighting Mod
Monochrome user interface

Is anyone in here interested in an extensive version of this script? If yes: which mods also require ini-tweaks?
Happy testing! :)

Re: [Linux] Ini-tweak migration script

Posted: 22 Oct 2017, 13:18
by Ambrevar
Thanks for this!

Some shell tips:

- Make it a "sh" script as this is POSIX, no need to depend on bash.

- Don't chain "echo"s, use a here-doc:

Code: Select all

Usage $0
- Exit early:

Code: Select all

if [ ! -e openmw.cfg ]
	## Redirect error messages to stderr.
	echo >&2 "openmw.cfg not found."
	## Change the exit code.
	exit 1

## Your un-indented sed command here.
- "sed" runs scripts, it is not limited to a single 's' command.

Code: Select all

sed -i '
' openmw.cfg
This will be much faster as it will fire up one process only.

Note that the inplace option (-i) is not standard, you should use the "ex" command instead.

- Always double-quote variables and use a single "=" for comparison:

Code: Select all

elif  [ "$1" = "-tlm_undo" ]
Hope that helps :)