From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Feb 20 2018 - 10:49:00 CST

Hi,
  You need to use Tcl's $env(VARIABLE) interface to obtain environment
variables set in external command shells prior to launching VMD.
Similarly, when using bash/bourne shells, you will need to use
"export FOO=BAR" to ensure that the variable propagates to subshells
and child processes like the VMD instance(s) you want to run.

Best regards,
  John Stone
  vmd_at_ks.uiuc.edu

On Mon, Feb 19, 2018 at 10:37:33PM +0000, Dive, Aniruddha Mukund wrote:
> Hi All,
>
> I am trying to make a bash script which will traverse through various
> directories and save the coordinates of the last frame from a trajectory
> in each of the directory. I have made a bash script attached hereby to
> help me traverse through different directories and along with that I have
> made another tcl script to save the coordinates of the last frame from the
> trajectory. The TCL script works fine without the variable introduced
> while loading the molecule. But when I introduce a variable in the name of
> the molecule in the TCL script, the script is not able to recognize the
> molecule and hence cannot load the molecule.
>
> Kindly let me know what could be a possible reason for this?
>
> Aniruddha M Dive
>
> PhD student
>
> School of Mechanical and Materials Engg.
>
> Washington State University

> set f [open tmp]
> set data [read $f]
> close $f
> puts "Si_S_config$data.pdb"
> mol load pdb Si_S_config$data.pdb
> [atomselect top all frame last] writepdb Si_S_config_$data.pdb
>

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/