From: GIUSEPPE LEONARDO LICARI (peppe.licari_at_hotmail.it)
Date: Mon May 09 2022 - 08:20:59 CDT

Dear all,
I am running the latest VMD version in text mode from a bash script using the following command:

vmd -eofexit -dispdev text -args ${vars_array[@]} < script.tcl

I would like to parse different exit codes from the TCL script to communicate if the script was successful or not. I tried to use “return” or “exit” followed by a number in the TCL script and grabbing the exit code from the vmd execution using e.g. EXIT_CODE=$?,
which is the standard way to find the exit code of the last command in Bash. However, I always get an exit code of 0

I have the impression that the TCL code terminates with the exit code I specify, but then VMD will terminate after the TCL code and will exit with 0 exit code. So Bash will always see the 0 exit code.

Do you have any idea how I could retrieve directly the exit code from the TCL and parse that to the bash script?

Best regards,
Giuseppe Licari