<?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: script question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947364#M289729</link>
    <description>Try replacing `uname -n` with $(uname -n) and make sure spacing is correct.</description>
    <pubDate>Mon, 19 Feb 2007 13:07:54 GMT</pubDate>
    <dc:creator>Sandman!</dc:creator>
    <dc:date>2007-02-19T13:07:54Z</dc:date>
    <item>
      <title>script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947361#M289726</link>
      <description>I have this script in which whenever I am trying to run it on hosta it does an equal for hostb and fails ...let me show u the set -x output : &lt;BR /&gt;&lt;BR /&gt;+ uname -n&lt;BR /&gt;+ [ hosta = hostb ]&lt;BR /&gt;&lt;BR /&gt;I have the if statement in the script for this which is failing : &lt;BR /&gt;&lt;BR /&gt;if [ `uname -n` = hostb ]&lt;BR /&gt;then&lt;BR /&gt;...&lt;BR /&gt;else&lt;BR /&gt;# should execute stuff meant for hosta&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Its weird in a sense that most of my other scrips are scripted the same way and I even tried having a variable for the uname -n command but it would still equal the wrong box.</description>
      <pubDate>Mon, 19 Feb 2007 12:35:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947361#M289726</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-02-19T12:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947362#M289727</link>
      <description>In fact I tried ( if then else fi ) with a sample script and do get the same message for set -x ( I mean hosta = hostb ) and it runs fine after that , so there is probably something wrong in my script after else.</description>
      <pubDate>Mon, 19 Feb 2007 13:03:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947362#M289727</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-02-19T13:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947363#M289728</link>
      <description>The statement:&lt;BR /&gt; &lt;BR /&gt;if [ `uname -n` = hostb ]&lt;BR /&gt; &lt;BR /&gt;is better written:&lt;BR /&gt; &lt;BR /&gt;if [ $(uname -n) = hostb ]&lt;BR /&gt; &lt;BR /&gt;as the backticks (aka, grave accent) have been deprecated for many years.&lt;BR /&gt; &lt;BR /&gt;As far as a failed match, uname -n reports what it was set to in the startup config file /etc/rc.config.d/netconf. On the machine that is failing, uname has been been set to an unexpected value. Scripting won't fix this because the box is misconfigured. uname -n is *NOT* connected with DNS (see the man page for uname). By convention the Internet name and uname will be the same but there is no restriction to make them different.</description>
      <pubDate>Mon, 19 Feb 2007 13:03:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947363#M289728</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2007-02-19T13:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947364#M289729</link>
      <description>Try replacing `uname -n` with $(uname -n) and make sure spacing is correct.</description>
      <pubDate>Mon, 19 Feb 2007 13:07:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947364#M289729</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-02-19T13:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947365#M289730</link>
      <description>Always identify your shell when asking a question like this.&lt;BR /&gt;&lt;BR /&gt;In any event, if the situation is as described, the else part should be executing.&lt;BR /&gt;&lt;BR /&gt;Try this (and apply some discplined quoting which you are missing):&lt;BR /&gt;&lt;BR /&gt;if [ "$(uname -n)" = "hostb" ]&lt;BR /&gt; then&lt;BR /&gt;   ...&lt;BR /&gt; else&lt;BR /&gt;   ...&lt;BR /&gt; fi &lt;BR /&gt;&lt;BR /&gt;or better still if using the Korn of POSIX shell:&lt;BR /&gt;if [[ "$(uname -n)" = "hostb" ]]&lt;BR /&gt; then&lt;BR /&gt;   ...&lt;BR /&gt; else&lt;BR /&gt;   ...&lt;BR /&gt; fi &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Feb 2007 13:11:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947365#M289730</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-02-19T13:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947366#M289731</link>
      <description>Hi,&lt;BR /&gt;use:&lt;BR /&gt;if [[ $(hostname) = hostb ]]&lt;BR /&gt;&lt;BR /&gt;or &lt;BR /&gt;&lt;BR /&gt;if [[ $(uname -n) = hostb ]]&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Tue, 20 Feb 2007 04:22:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/3947366#M289731</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2007-02-20T04:22:18Z</dc:date>
    </item>
  </channel>
</rss>

