<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic RE: Problems with comparing a string with a variable in Scripting</title>
    <link>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20075#M180</link>
    <description>Create Date: Jul 12 2013  2:32PM&lt;BR /&gt;
&lt;BR /&gt;
Ah..that was strings .. &lt;BR /&gt;
&lt;BR /&gt;
 maybe this would help you &lt;BR /&gt;
while ( ! [string equal $par1 "Image" ] ) do &lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Jarek  (from Jaroslaw_Kasjaniuk)</description>
    <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
    <dc:creator>EtherNation_Use</dc:creator>
    <dc:date>2014-01-08T05:50:00Z</dc:date>
    <item>
      <title>Problems with comparing a string with a variable</title>
      <link>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20072#M177</link>
      <description>Create Date: Jul 11 2013  2:15PM&lt;BR /&gt;
&lt;BR /&gt;
Hi,&lt;BR /&gt;
&lt;BR /&gt;
I want to compare the content of a variable with a string, but it doesn't works.&lt;BR /&gt;
&lt;BR /&gt;
Here the posting of some examples and the error messages which I get:&lt;BR /&gt;
&lt;BR /&gt;
# variables&lt;BR /&gt;
set var count 0&lt;BR /&gt;
set var par1  "Image"&lt;BR /&gt;
&lt;BR /&gt;
# example 1&lt;BR /&gt;
set var count ($count + 1)&lt;BR /&gt;
show var count&lt;BR /&gt;
while ("$par1" != "Image") DO&lt;BR /&gt;
show var $par1&lt;BR /&gt;
endwhile&lt;BR /&gt;
# Message:&lt;BR /&gt;
# Error:can't read "par1": no such variable&lt;BR /&gt;
# Variable Image not found.&lt;BR /&gt;
# Error: Mismatched ENDWHILE&lt;BR /&gt;
&lt;BR /&gt;
 &lt;BR /&gt;
&lt;BR /&gt;
# example 2&lt;BR /&gt;
set var count ($count + 1)&lt;BR /&gt;
show var count&lt;BR /&gt;
while ("Image" != "Image") DO&lt;BR /&gt;
show var $par1&lt;BR /&gt;
endwhile&lt;BR /&gt;
# No Error-Message&lt;BR /&gt;
&lt;BR /&gt;
# example 3&lt;BR /&gt;
set var count ($count + 1)&lt;BR /&gt;
show var count&lt;BR /&gt;
&lt;BR /&gt;
while (part1 != "Image") DO&lt;BR /&gt;
show var $par1&lt;BR /&gt;
endwhile&lt;BR /&gt;
#Error-Message:&lt;BR /&gt;
#Error:syntax error in expression "(part1 != "Image")"&lt;BR /&gt;
&lt;BR /&gt;
#Variable Image not found.&lt;BR /&gt;
#Error: Mismatched ENDWHILE&lt;BR /&gt;
&lt;BR /&gt;
Does somebody knows the rigth syntax?&lt;BR /&gt;
&lt;BR /&gt;
  (from Hans_Vedder)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20072#M177</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: Problems with comparing a string with a variable</title>
      <link>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20073#M178</link>
      <description>Create Date: Jul 11 2013  4:31PM&lt;BR /&gt;
&lt;BR /&gt;
Hi, &lt;BR /&gt;
&lt;BR /&gt;
try -&amp;gt; while ( $par1 != "Image") &lt;BR /&gt;
&lt;BR /&gt;
Jarek  (from Jaroslaw_Kasjaniuk)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20073#M178</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: Problems with comparing a string with a variable</title>
      <link>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20074#M179</link>
      <description>Create Date: Jul 12 2013  8:21AM&lt;BR /&gt;
&lt;BR /&gt;
I tried:&lt;BR /&gt;
&lt;BR /&gt;
set var par1  "Image"&lt;BR /&gt;
while ($par1 != "Image") DO&lt;BR /&gt;
show var $par1&lt;BR /&gt;
endwhile&lt;BR /&gt;
&lt;BR /&gt;
and get the error message:&lt;BR /&gt;
&lt;BR /&gt;
Error:syntax error in expression "(Image != "Image")"&lt;BR /&gt;
&lt;BR /&gt;
Variable Image not found.&lt;BR /&gt;
Error: Mismatched ENDWHILE&lt;BR /&gt;
&lt;BR /&gt;
  (from Hans_Vedder)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20074#M179</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: Problems with comparing a string with a variable</title>
      <link>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20075#M180</link>
      <description>Create Date: Jul 12 2013  2:32PM&lt;BR /&gt;
&lt;BR /&gt;
Ah..that was strings .. &lt;BR /&gt;
&lt;BR /&gt;
 maybe this would help you &lt;BR /&gt;
while ( ! [string equal $par1 "Image" ] ) do &lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Jarek  (from Jaroslaw_Kasjaniuk)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20075#M180</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: Problems with comparing a string with a variable</title>
      <link>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20076#M181</link>
      <description>Create Date: Jul 15 2013 12:12PM&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much. This works fine.&lt;BR /&gt;
&lt;BR /&gt;
You used the syntax:&lt;BR /&gt;
&lt;BR /&gt;
while ( [string equal $par1 Image ] ) do&lt;BR /&gt;
...&lt;BR /&gt;
&lt;BR /&gt;
Where do I find the syntax of the string command? It's not described in the &lt;B&gt;Concepts Guide 15.3&lt;/B&gt;.&lt;BR /&gt;
&lt;BR /&gt;
There I read:&lt;BR /&gt;
== Boolean equal &lt;BR /&gt;
!= Boolean not equal&lt;BR /&gt;
&lt;BR /&gt;
Each operator produces a zero or one result. These operators are valid for &lt;B&gt;all operand types.&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
 &lt;BR /&gt;
&lt;BR /&gt;
 &lt;BR /&gt;
&lt;BR /&gt;
  (from Hans_Vedder)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20076#M181</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: Problems with comparing a string with a variable</title>
      <link>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20077#M182</link>
      <description>Create Date: Jul 15 2013 12:30PM&lt;BR /&gt;
&lt;BR /&gt;
That is TCL language, in EXOS you can use it but it's a bit "limited version".&lt;BR /&gt;
You can find many examples in the internet, for exampl. http://wiki.tcl.tk/.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Jarek  (from Jaroslaw_Kasjaniuk)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/problems-with-comparing-a-string-with-a-variable/m-p/20077#M182</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
  </channel>
</rss>

