<?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: comparing 2 string variables in a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253141#M658640</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Quote each variable used in the test command:&lt;BR /&gt;&lt;BR /&gt;if [[ "$prodid" = "$testid" ]]&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Wed, 25 Aug 2010 18:40:07 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2010-08-25T18:40:07Z</dc:date>
    <item>
      <title>comparing 2 string variables in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253140#M658639</link>
      <description>I'm trying to compare 2 character string variables in a Korn Shell script without success:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;testid=$(id $1)&lt;BR /&gt;echo $testid&lt;BR /&gt;prodid=$(remsh epicprod -n "id $1")&lt;BR /&gt;echo $prodid&lt;BR /&gt;if [[ $prodid = $testid ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "uid's are the same on both systems"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;There must be something wrong with my '$prodid = $testid' expression because even though the earlier echoes show identical character strings, the expression does not see them as equivalent.&lt;BR /&gt;What am I missing?</description>
      <pubDate>Wed, 25 Aug 2010 18:28:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253140#M658639</guid>
      <dc:creator>Randolph Knippel</dc:creator>
      <dc:date>2010-08-25T18:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 string variables in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253141#M658640</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Quote each variable used in the test command:&lt;BR /&gt;&lt;BR /&gt;if [[ "$prodid" = "$testid" ]]&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 25 Aug 2010 18:40:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253141#M658640</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-08-25T18:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 string variables in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253142#M658641</link>
      <description>Hi (again) Randolph:&lt;BR /&gt;&lt;BR /&gt;And here's a simple test to show you the reason:&lt;BR /&gt;&lt;BR /&gt;# X="a b c";Y="a b c";[ $X = $Y ] &amp;amp;&amp;amp; echo same || echo differ&lt;BR /&gt;ksh: b: 0403-012 A test command parameter is not valid.&lt;BR /&gt;differ&lt;BR /&gt;&lt;BR /&gt;# X="a b c";Y="a b c";[ "$X" = "$Y" ] &amp;amp;&amp;amp; echo same || echo differ&lt;BR /&gt;&lt;BR /&gt;You need to compare one string to one string, not multiple ones.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 25 Aug 2010 18:46:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253142#M658641</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-08-25T18:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 string variables in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253143#M658642</link>
      <description>Solution provided in replies.</description>
      <pubDate>Wed, 25 Aug 2010 21:02:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253143#M658642</guid>
      <dc:creator>Randolph Knippel</dc:creator>
      <dc:date>2010-08-25T21:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: comparing 2 string variables in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253144#M658643</link>
      <description>&amp;gt;if [[ "$prodid" = "$testid" ]]&lt;BR /&gt;&lt;BR /&gt;Note: This is NOT comparing strings, this is doing pattern matching.&lt;BR /&gt;It might be better to use the tried and true:&lt;BR /&gt;if [ "$prodid" = "$testid" ]</description>
      <pubDate>Thu, 26 Aug 2010 05:05:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-2-string-variables-in-a-script/m-p/5253144#M658643</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-08-26T05:05:36Z</dc:date>
    </item>
  </channel>
</rss>

