Hi all,
I understand that this is very old question but today I faced the same issue and this thread was among the first find by google but while helpful I still spend a lot of time making it work due to my missing TCL knowledge. Therefore I am posting my full solution in hope it will be helpful.
Makefile/script:
export TEST_NAME="real_pcap_test"
vsim -c -do "file.do"
file.do:
global env
set UCDB_NAME $env(TEST_NAME)
run 1ms
coverage save -onexit ${UCDB_NAME}.ucdb