[Fwd: Re: VMD/psfgen scripting: undefined variable]

From: Victor Ovchinnikov (ovchinnv_at_MIT.EDU)
Date: Fri Nov 09 2007 - 00:33:00 CST

attached mail follows:


Looks like your shell is translating $x inside the here-doc; try \$
instead of $ to tell it not to.

Victor

On Thu, 2007-11-08 at 22:30 -0600, Richard Baxter wrote:
> Dear All,
>
> Can anyone explain the following to me? An interactive vmd session:
>
> kong <10:21pm> 126% vmd -dispdev text
> Info) VMD for LINUX, version 1.8.6 (April 6, 2007)
> ..
> vmd > set x 10
> 10
> vmd > puts "the value of x is $x"
> the value of x is 10
> vmd > quit
> Info) VMD for LINUX, version 1.8.6 (April 6, 2007)
> Info) Exiting normally.
>
> Now try putting it in the following script:
> setup vmd
> which vmd
> vmd -dispdev text <<END
> set x 10
> puts "the value of x is: $x"
> quit
> END
>
> and you get:
> kong <10:21pm> 127% ./test.com
> /usr/progs/vmd-1.8/bin/vmd
> Info) VMD for LINUX, version 1.8.6 (April 6, 2007)
> ..
> 10
> the value of x is:
> Info) VMD for LINUX, version 1.8.6 (April 6, 2007)
> Info) Exiting normally.
>
> Let's try an interactive psfgen session:
> kong <10:24pm> 129% psfgen
> PSFGEN from NAMD 2.6 for Linux-i686
> % set x 10
> 10
> % puts "the value of x is $x"
> the value of x is 10
> % exit
>
> Now put that in a script:
> setup namd
> which psfgen
> psfgen <<END
> set x 10
> puts "the value of x is: $x"
> exit
> END
>
> and you get:
> /usr/progs/NAMD_2.6_Linux-i686/psfgen
> PSFGEN from NAMD 2.6 for Linux-i686
> the value of x is:
> kong <10:25pm> 132%
>
> At least the vmd script spat out the value of x, but didn't call it.
> PSFGEN didn't even return the variable value when set! I am at a loss to
> explain, expecially since I already went through the VMD and NAMD
> tutorials and those scripts worked fine.
>
> Help!
>
> Richard
>

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:45:30 CST