Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Macro name changed from html to html-bobswift during server to cloud migration processing.

...

Anchor
1089023
1089023
The syntax of the fordata statement is:

Panel

Html bobswift

<pre>
fordata variable-name=data-element
...
end
</pre>

Anchor
1089027
1089027
Example

Panel

Html bobswift

<pre>
set i=1
loaddata mydata=mydata.txt
fordata line=mydata
    echo "$(i): $(line)"

    compare "$(line)" "exit" case=yes

    if <"$(_lastrc.message)" EQ "MATCH">
        echo
        echo "Data contains an 'exit' command"
        echo
    end

    set i=<$(i) + 1>
end
</pre>


If a data element called mydata.txt contained the following contents:

Panel

Html bobswift

<pre>
cd /
ls -al
exit
</pre>


Running this script against the contents of mydata would produce the following results:

Panel

Html bobswift

<pre>
1: cd /
2: ls -al
3: exit
Data contains an 'exit' command
</pre>