<?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: Strange ksh behaviour in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891030#M402341</link>
    <description>I consider this issue to be a bug in ksh.&lt;BR /&gt;Perhaps moderator could get HP-UX support's attention regarding the problem.</description>
    <pubDate>Thu, 17 Mar 2005 12:51:48 GMT</pubDate>
    <dc:creator>Vitek Pepas</dc:creator>
    <dc:date>2005-03-17T12:51:48Z</dc:date>
    <item>
      <title>Strange ksh behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891025#M402336</link>
      <description>Can anyone explain following ksh behaviour:&lt;BR /&gt;(there are no *.cpp files in /, I get the same result on 10.20 and 11.11)&lt;BR /&gt;&lt;BR /&gt;scchp2:/&amp;gt; [[ 1.cpp = '*'.cpp ]] ; echo $?&lt;BR /&gt;+ [[ 1.cpp = *.cpp ]]&lt;BR /&gt;+ echo 1&lt;BR /&gt;1&lt;BR /&gt;&lt;BR /&gt;scchp2:/&amp;gt; a='1.cpp'; e=.cpp ;[[ $a = '*'$e ]]; echo $?&lt;BR /&gt;+ a=1.cpp&lt;BR /&gt;+ e=.cpp&lt;BR /&gt;+ [[ 1.cpp = *.cpp ]]&lt;BR /&gt;+ echo 0&lt;BR /&gt;0&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Mar 2005 15:01:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891025#M402336</guid>
      <dc:creator>Vitek Pepas</dc:creator>
      <dc:date>2005-03-14T15:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Strange ksh behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891026#M402337</link>
      <description>Is there a file called /1 ?  &lt;BR /&gt;If so, I think that it's your problem...&lt;BR /&gt;You're not comparing 1.cpp to "`.cpp" - &lt;BR /&gt;you're comparing 1.cpp to possibly "1".cpp.&lt;BR /&gt;Meaning - you might be finding true the match between "1.cpp" and "1" b/c you're adding ".cpp" to the find of "*" yourself, instead of asking the OS to match it.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Mar 2005 15:14:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891026#M402337</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-03-14T15:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Strange ksh behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891027#M402338</link>
      <description>vitek,&lt;BR /&gt;&lt;BR /&gt;You are not expanding *.cpp to file listing here. With '*' * will be taken as literal character and will be compared with 1.cpp which is not true so you are getting 1 as output.&lt;BR /&gt;&lt;BR /&gt;If you do same comparison without ''&lt;BR /&gt;&lt;BR /&gt;[[ 1.cpp = *.cpp ]] ; echo $?&lt;BR /&gt;&lt;BR /&gt;here * is treated as wild character so * will become 1 in this case and your result will true (0).</description>
      <pubDate>Mon, 14 Mar 2005 15:23:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891027#M402338</guid>
      <dc:creator>Rajeev Tyagi</dc:creator>
      <dc:date>2005-03-14T15:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Strange ksh behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891028#M402339</link>
      <description>I know I'm comparing strings rather than file listings here. I put the comment about the file to eliminate suspicion that ksh is doing it anyway.&lt;BR /&gt;I should get the same result in both cases regardless of files existing in current directory.</description>
      <pubDate>Mon, 14 Mar 2005 15:28:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891028#M402339</guid>
      <dc:creator>Vitek Pepas</dc:creator>
      <dc:date>2005-03-14T15:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Strange ksh behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891029#M402340</link>
      <description>Well, after playing with it for a while I want to a) negate my previous post.... b) say, I've got no idea why it's doing that - except that it has to do with expansion and protection of the test variables - against the expansion of the variables in the other case.&lt;BR /&gt;I even thought it had to do with the protection of '*' - but moving it around and unprotecting it yields the same...&lt;BR /&gt;&lt;BR /&gt;/# a='1.cpp'; e=.cpp ;[[ $a = '*'$e ]]; echo $?&lt;BR /&gt;0&lt;BR /&gt;/# a='1.cpp'; e='*'.cpp ;[[ $a = $e ]]; echo $?&lt;BR /&gt;0&lt;BR /&gt;/# a='1.cpp'; e=*.cpp ;[[ $a = $e ]]; echo $?&lt;BR /&gt;0&lt;BR /&gt;&lt;BR /&gt;Interesting but at last I arrived at...&lt;BR /&gt;a='1.cpp'; e=*.cpp ;[[ $a = "$e" ]]; echo $?&lt;BR /&gt;1&lt;BR /&gt;&lt;BR /&gt;So, I think it has to with the fact that the shell agrees that 1.cpp is a truth for an expansion of *.cpp; but in the last example the shell knows that the string "1.cpp" is NOT the same as the string literal "*.cpp".&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Mar 2005 15:28:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891029#M402340</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-03-14T15:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Strange ksh behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891030#M402341</link>
      <description>I consider this issue to be a bug in ksh.&lt;BR /&gt;Perhaps moderator could get HP-UX support's attention regarding the problem.</description>
      <pubDate>Thu, 17 Mar 2005 12:51:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/strange-ksh-behaviour/m-p/4891030#M402341</guid>
      <dc:creator>Vitek Pepas</dc:creator>
      <dc:date>2005-03-17T12:51:48Z</dc:date>
    </item>
  </channel>
</rss>

