Hi Emile and James, Yes, this is a known bug with the spawn command. Thank you for the workaround, James. Ansley Manke James Orr wrote: Emilie, You followed what was in the manual, and you are right: it does NOT work. On the other hand it would work if you only listed the files without using the spawn command, e.g., let my_files = {"dummy", "box.dat", "boxmar.dat", "dummy"} A work around (while using the spawn command) would be to do the following let my_files = {"dummy", spawn: "ls box*.dat", "dummy"} let len_files = strlen(my_files) let one_files = if len_files gt 0 then 1 let n = one_files[i=@sum] list n -- Jim On Tue, 14 Sep 2004, Emilie Vanvyve wrote:Hello, I have a little problem when I do the following to count the number of elements I have in a string array: yes? spawn ls box.dat plot-xy-hlat.jnl plot-xy-ro.jnl plot-xy.set-mask.jnl boxmar.dat plot-xy-precp.jnl plot-xy-t2m.jnl plot-xy.set-shakey.jnl yes? yes? let my_files = {"dummy", spawn: "ls box*.dat", "dummy"} yes? list my_files VARIABLE : {"dummy", SPAWN: "ls box*.dat", "dummy"} SUBSET : 4 points (X) 1 / 1:"dummy" 2 / 2:"box.dat" 3 / 3:"boxmar.dat" 4 / 4:"dummy" yes? yes? let n = `my_files,return=iend` !-> DEFINE VARIABLE n = 2002 yes? let n = `my_files,return=jend` !-> DEFINE VARIABLE n = 0 yes? let n = `my_files,return=kend` !-> DEFINE VARIABLE n = 0 yes? let n = `my_files,return=lend` !-> DEFINE VARIABLE n = 0 yes? Why is it so? Why do I not get n=4? I'm likely to have done just a stupid mistake somewhere, but I don't see. Emilie ____________________________________________________________ Emilie VANVYVE Physicist, PhD student Université catholique de Louvain (UCL) Institut d'astronomie et de géophysique G. Lemaître (ASTR) Chemin du Cyclotron, 2 1348 Louvain-la-Neuve (Belgium) Phone : +32-(0)10-473300 Fax : +32-(0)10-474722 E-mail : vanvyve@astr.ucl.ac.be Web : www.astr.ucl.ac.be |