Interactive mode & batch scripts¶
When you're running several commands against the same database, you don't want to repeat -db each
time. Two ways to avoid that:
Interactive mode¶
Start und with a database to open an interactive session:
$ und myProject.und
Welcome to und. Type "help" for a list of commands. "quit" to quit
und> add thisFile.txt # runs against myProject.und, specified at the start
File: C:\work\src\thisFile.txt has been added.
Files added: 1
und> analyze -changed
und> -db otherProject.und # switch databases mid-session
Every command runs against the remembered database until you switch it with -db. Full details are
on the und interactive reference page.
Batch: und process¶
und process runs all commands in a text file, remembering the database set at the start:
# build.txt — lines after '#' are ignored, one command per line
add /path/to/src
settings -C++AddFoundFilesToProject on
analyze
codecheck -exitstatus "MyConfig" out
und -db myProject.und process build.txt
The file uses one command per line; anything after # is a comment. The database comes from the
command line (or interactive session) until a -db (or a bare project.und line) inside the file
changes it. You can also run a file directly at startup — und build.txt is shorthand for
und process build.txt. See the und process reference page.