<?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: test not working in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206018#M714243</link>
    <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;look for set -u&lt;BR /&gt;or #!/bin/sh -u&lt;BR /&gt;or similar.&lt;BR /&gt;&lt;BR /&gt;Michael</description>
    <pubDate>Mon, 01 Mar 2004 13:11:15 GMT</pubDate>
    <dc:creator>Michael Schulte zur Sur</dc:creator>
    <dc:date>2004-03-01T13:11:15Z</dc:date>
    <item>
      <title>test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206012#M714237</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;For some reason my test for non-zero is not working on $newgrp. any ideas?&lt;BR /&gt;&lt;BR /&gt;unset who&lt;BR /&gt;who=`/usr/bin/who am i`&lt;BR /&gt;&lt;BR /&gt;if [ -n "$who" ]&lt;BR /&gt;then&lt;BR /&gt;if [ -n "$newgrp" ]&lt;BR /&gt;then&lt;BR /&gt;newgrp $newgrp&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;The error is :&lt;BR /&gt;${HOME:-.}/.profile[35]: newgrp: parameter not set &lt;BR /&gt;&lt;BR /&gt;This is why I had the test in, right? It's quoted, so I don't see the problem?&lt;BR /&gt;&lt;BR /&gt;Regs David</description>
      <pubDate>Mon, 01 Mar 2004 12:52:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206012#M714237</guid>
      <dc:creator>Wim Korten</dc:creator>
      <dc:date>2004-03-01T12:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206013#M714238</link>
      <description>What if you do&lt;BR /&gt;&lt;BR /&gt;newgrp=""&lt;BR /&gt;&lt;BR /&gt;first and then try.&lt;BR /&gt;&lt;BR /&gt;#newgrp=""&lt;BR /&gt;#if [ -n "$newgrp" ]&lt;BR /&gt;&amp;gt;then&lt;BR /&gt;&amp;gt;echo yes&lt;BR /&gt;&amp;gt;fi&lt;BR /&gt;&lt;BR /&gt;returns nothing&lt;BR /&gt;&lt;BR /&gt;#unset newgrp&lt;BR /&gt;#if [ -n "$newgrp" ]&lt;BR /&gt;&amp;gt;then&lt;BR /&gt;&amp;gt;echo yes&lt;BR /&gt;&amp;gt;fi&lt;BR /&gt;&lt;BR /&gt;sh: newgrp: Parameter not set.&lt;BR /&gt;&lt;BR /&gt;newgrp="1"&lt;BR /&gt;&lt;BR /&gt;if [ -n "$newgrp" ]^Jthen^Jecho yes^Jfi&lt;BR /&gt;yes&lt;BR /&gt;&lt;BR /&gt;Seems to work.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave.</description>
      <pubDate>Mon, 01 Mar 2004 13:00:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206013#M714238</guid>
      <dc:creator>David Burgess</dc:creator>
      <dc:date>2004-03-01T13:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206014#M714239</link>
      <description>newgrp is undefined as a variable. Put in the begining of the script:&lt;BR /&gt;&lt;BR /&gt;newgrp=&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Marty</description>
      <pubDate>Mon, 01 Mar 2004 13:00:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206014#M714239</guid>
      <dc:creator>Martin Johnson</dc:creator>
      <dc:date>2004-03-01T13:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206015#M714240</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;look for set -u&lt;BR /&gt;If set, unset variables will result in an error.&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 01 Mar 2004 13:02:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206015#M714240</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-03-01T13:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206016#M714241</link>
      <description>Weird,&lt;BR /&gt;&lt;BR /&gt;No typos? strange characters?&lt;BR /&gt;First script line is used to spceify shell (#!/bin/ksh or something like that)?&lt;BR /&gt;&lt;BR /&gt;??&lt;BR /&gt;JP</description>
      <pubDate>Mon, 01 Mar 2004 13:02:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206016#M714241</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-03-01T13:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206017#M714242</link>
      <description>It's a combination of scripts. At the total end I would like to test if $newgrp is set.&lt;BR /&gt;&lt;BR /&gt;So first unsetting would not be really apropriate :)&lt;BR /&gt;&lt;BR /&gt;I'dd say that test with a quoted var would always succeed?&lt;BR /&gt;&lt;BR /&gt;Question is still open.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regs David</description>
      <pubDate>Mon, 01 Mar 2004 13:07:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206017#M714242</guid>
      <dc:creator>Wim Korten</dc:creator>
      <dc:date>2004-03-01T13:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206018#M714243</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;look for set -u&lt;BR /&gt;or #!/bin/sh -u&lt;BR /&gt;or similar.&lt;BR /&gt;&lt;BR /&gt;Michael</description>
      <pubDate>Mon, 01 Mar 2004 13:11:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206018#M714243</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-03-01T13:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206019#M714244</link>
      <description>Martin is right.&lt;BR /&gt; &lt;BR /&gt;The $newgrp variable is not set.  the "-n" option of test does not test for the existance of a variable, only that it is not empty.&lt;BR /&gt; &lt;BR /&gt;There may be a smarter way but you need something like&lt;BR /&gt; &lt;BR /&gt;if [ $newgrp ] &amp;amp;&amp;amp; [ -n $newgrp ]&lt;BR /&gt; &lt;BR /&gt;However, if newgrp is not defined, this will always be false.</description>
      <pubDate>Mon, 01 Mar 2004 13:12:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206019#M714244</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-03-01T13:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206020#M714245</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;There is no applicable man for set, nor sh that explains the -u flag.&lt;BR /&gt;&lt;BR /&gt;Regs David</description>
      <pubDate>Mon, 01 Mar 2004 13:15:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206020#M714245</guid>
      <dc:creator>Wim Korten</dc:creator>
      <dc:date>2004-03-01T13:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206021#M714246</link>
      <description>Hi David,&lt;BR /&gt;&lt;BR /&gt;Well. This is because you can find a line "set -u" in your .profile. Irrespective of -n test, 'set -u' going to error out if newgrp is not set. You can override it with &lt;BR /&gt;&lt;BR /&gt;set +u&lt;BR /&gt;your_script&lt;BR /&gt;set -u&lt;BR /&gt;&lt;BR /&gt;However, you will need to use it at your own risk. &lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Mon, 01 Mar 2004 13:15:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206021#M714246</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-03-01T13:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206022#M714247</link>
      <description>Hi David,&lt;BR /&gt;&lt;BR /&gt;look man sh-bourne&lt;BR /&gt;and search for -u&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 01 Mar 2004 13:18:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206022#M714247</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-03-01T13:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: test not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206023#M714248</link>
      <description>In the shell man pages:&lt;BR /&gt;set -u   # treats unset variable as error&lt;BR /&gt;&lt;BR /&gt;Als add a &lt;BR /&gt;set -xv&lt;BR /&gt;to your script. This will show the script commands as they are being executed.&lt;BR /&gt;&lt;BR /&gt;JP.</description>
      <pubDate>Tue, 02 Mar 2004 01:04:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-not-working/m-p/3206023#M714248</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-03-02T01:04:28Z</dc:date>
    </item>
  </channel>
</rss>

