From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Mon Jul 25 2011 - 14:33:37 CDT

On Mon, Jul 25, 2011 at 2:51 PM, Pavan Ghatty <pavan.vmd_at_gmail.com> wrote:
> Hello All,
> I have one of the following two files in my workdir. protein.pdb or
> edit_protein.pdb
> I would like to do the following:
> 1. ls *.pdb
> 2. mol new [ls*.pdb]

this _cannot_ work since mol new only takes a single file as an argument.

> This clearly doesn't work.
> I tried to see if I could at least select the file using; ls *.pdb.
> ---------------
> vmd > ls *.pdb
> /bin/ls: cannot access *.pdb: No such file or directory
> child process exited abnormally
> ---------------

yes. this has to be, since the ls command actually doesn't
do the expansion of the * wildcard, but the shell itself does it
when to you type "ls *.pdb" (this is called globbing and can
be disabled even).

> I then found out that this works;
> eval ls [glob *.pdb]
> But then the following does not work;
> mol new [eval ls [glob *.pdb]]
> nor does this
> mol load pdb [eval ls [glob *.pdb]]
> They both die with this error;
> Warning) Unable to ascertain filetype from filename ''; assuming pdb.
> Can somebody help me out here?

yes, because you have the principle error that mol new only accepts
one file name
per invocation. what you have to do is to build a loop (an example for that was
given on the list earlier using some quirky find shell command).

so if you do:

foreach f [glob *.pdb] {
   mol new $f waitfor all
}

you should get what you desire.

axel.

> Thanks.

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.