FOREACH skips first entry of self created LIST

Post a message here if you find anything wrong in ScriptFTP.

FOREACH skips first entry of self created LIST

Postby terrabio » 30 Dec 2009, 09:28

Given the following script:

Code: Select all
#test.ftp
$mylist = "1|2|3"
FOREACH $item in $mylist
     PRINT $item
END FOREACH


following output is generated:

Code: Select all
Running C:\test.ftp
2
3


The first item is skipped!

I know that including a leading "|" will do the job ($mylist = "|1|2|3"),
but this is not mentioned in the scripting guide (GETLIST; section "Remarks")

Is this a bug or a feature, means you have to change it in scriptftp or in the documentation?
terrabio
 
Posts: 3
Joined: 30 Dec 2009, 08:54

Re: FOREACH skips first entry of self created LIST

Postby ScriptFTP support » 03 Jan 2010, 15:28

Hello terrabio,

Well, it's a bug. I have realized that the separator character "|" must be put before every item. For example:

Code: Select all
$mylist  = "|1|2|3"


This will work but according to the documentation (and the common sense) your script should also work.

Thanks for reporting this. It will be fixed in the next release (3.4)
ScriptFTP support
Site Admin
 
Posts: 624
Joined: 04 Aug 2008, 15:08
Location: Burgos, Spain, EU


Return to Bug reports



Who is online

Users browsing this forum: No registered users and 1 guest