<?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: how to compare a null string in UNIX Shell in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284034#M882363</link>
    <description>Thanks for your response but my file date has space between it. The file date is like file_date=May 20 14:40&lt;BR /&gt;&lt;BR /&gt;if I do [[ -z "${file_date}" ] the program is till thinking that the file date is null.&lt;BR /&gt;&lt;BR /&gt;Please tell what am I doing wrong here?&lt;BR /&gt;&lt;BR /&gt;Thank You&lt;BR /&gt;Suman</description>
    <pubDate>Sun, 23 May 2004 07:59:42 GMT</pubDate>
    <dc:creator>Suman_7</dc:creator>
    <dc:date>2004-05-23T07:59:42Z</dc:date>
    <item>
      <title>how to compare a null string in UNIX Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284031#M882360</link>
      <description>All,&lt;BR /&gt;&lt;BR /&gt;I need to compare a null string comparison like this:&lt;BR /&gt;&lt;BR /&gt; if [ ${STAT} -ne 0 -o &lt;BR /&gt;     "${file_date}" = " " ]; then&lt;BR /&gt; echo "file date is NULL"&lt;BR /&gt; fi&lt;BR /&gt;&lt;BR /&gt;But my code is not working. ${STAT} is the exit status.&lt;BR /&gt;&lt;BR /&gt;Please suggest me what am I doing wrong.. Thank You,&lt;BR /&gt;Suman</description>
      <pubDate>Sun, 23 May 2004 00:03:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284031#M882360</guid>
      <dc:creator>Suman_7</dc:creator>
      <dc:date>2004-05-23T00:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare a null string in UNIX Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284032#M882361</link>
      <description>do a -z "${file_date}"&lt;BR /&gt;&lt;BR /&gt;and if you have your shell patched with recent patches the proper syntax would be:&lt;BR /&gt;&lt;BR /&gt;if (( $STAT} != 0 )) || [[ -z "${file_date}" ]] ;then&lt;BR /&gt;print "file date is null"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;[...] and echo are obsolete&lt;BR /&gt;&lt;BR /&gt;and if you just want an error message&lt;BR /&gt;&lt;BR /&gt;print ${file_date:?}&lt;BR /&gt;&lt;BR /&gt;will do that for you</description>
      <pubDate>Sun, 23 May 2004 00:25:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284032#M882361</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-05-23T00:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare a null string in UNIX Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284033#M882362</link>
      <description>Hi Suman,&lt;BR /&gt;&lt;BR /&gt;-z is what I use too.&lt;BR /&gt;&lt;BR /&gt;I believe, Curt intended to write&lt;BR /&gt;&lt;BR /&gt;if [[ ${STAT} != 0 ]] || [[ -z "${file_date}" ]] ;then&lt;BR /&gt;print "file date is null"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;</description>
      <pubDate>Sun, 23 May 2004 01:50:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284033#M882362</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-05-23T01:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare a null string in UNIX Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284034#M882363</link>
      <description>Thanks for your response but my file date has space between it. The file date is like file_date=May 20 14:40&lt;BR /&gt;&lt;BR /&gt;if I do [[ -z "${file_date}" ] the program is till thinking that the file date is null.&lt;BR /&gt;&lt;BR /&gt;Please tell what am I doing wrong here?&lt;BR /&gt;&lt;BR /&gt;Thank You&lt;BR /&gt;Suman</description>
      <pubDate>Sun, 23 May 2004 07:59:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284034#M882363</guid>
      <dc:creator>Suman_7</dc:creator>
      <dc:date>2004-05-23T07:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare a null string in UNIX Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284035#M882364</link>
      <description>I am able to get it working now.&lt;BR /&gt;&lt;BR /&gt;Thank You for your help.&lt;BR /&gt;&lt;BR /&gt;Suman</description>
      <pubDate>Sun, 23 May 2004 08:16:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-compare-a-null-string-in-unix-shell/m-p/3284035#M882364</guid>
      <dc:creator>Suman_7</dc:creator>
      <dc:date>2004-05-23T08:16:21Z</dc:date>
    </item>
  </channel>
</rss>

