I am working with VMD (a molecular dynamics visualization package) and I want to open VMD from a Perl script, run a Tcl script, print the output to a log file, then close VMD and return to the Perl script. The ordinary syntax to do this is:
system("vmd -dispdev text -eofexit < program.tcl > LOG");
which breaks down as follows, as best as I understand:
system("");
: executes Bourne Shell commands contained in quotesvmd
: calls VMD-dispdev text
: opens VMD in text mode-eofexit
: terminates VMD when EOF on STDIN is reached< prog.tcl
: setsprog.tcl
as STDIN; vmd will terminate whenprog.tcl
completes> LOG
: writes STOUT to file<LOG>
Now this would work perfectly, except that my Tcl script takes arguments. What I'd like to do is something like:
system("vmd -dispdev text -eofexit < program.tcl string1 string2 > LOG");
however, in this case the shell tries to read string1 and string2 as files. With my limited understanding of redirection, I'm not sure exactly what is going in the first line, what exactly goes wrong in the second, or what a good solution would be. Any help would be appreciated.