<?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: Issue with shell scripts environment variable in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275551#M657102</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;First, use either double or single quotes *only* to surround the whole command:&lt;BR /&gt;&lt;BR /&gt;# RUN_CMD="ls -l | grep -v -E "total|SERVER" | cut -d' ' -f1|sort -r"&lt;BR /&gt;&lt;BR /&gt;Now, do:&lt;BR /&gt;&lt;BR /&gt;# eval ${RUN_CMD}&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Wed, 02 Mar 2011 14:08:34 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2011-03-02T14:08:34Z</dc:date>
    <item>
      <title>Issue with shell scripts environment variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275550#M657101</link>
      <description>Hi All&lt;BR /&gt;&lt;BR /&gt;I'm writing a script in which the command I need to run might change depending on certain conditions. Therefore I'm building the command line and saving this command in an environment variable, which I run at a later stage.&lt;BR /&gt;&lt;BR /&gt;Something like RUN_CMD="ls -l | grep -v -E "total|SERVER" | cut -d' ' -f1|sort -r"&lt;BR /&gt;&lt;BR /&gt;The command line is just an example, but I have to combine more than one commands using a pipe.&lt;BR /&gt;&lt;BR /&gt;When I try to run this constructed command line, I get error messages like -v no such file etc.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;|grep: unknown host name.&lt;BR /&gt;-v: unknown host name.&lt;BR /&gt;-E: unknown host name.&lt;BR /&gt;"HOST_NAME|host1|host2"|: unknown host name.&lt;BR /&gt;cut: unknown host name.&lt;BR /&gt;-d': unknown host name.&lt;BR /&gt;': unknown host name.&lt;BR /&gt;-f1|sort: unknown host name.&lt;BR /&gt;-r: unknown host name.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for your suggetions.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Kaushik</description>
      <pubDate>Wed, 02 Mar 2011 13:59:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275550#M657101</guid>
      <dc:creator>kaushikbr</dc:creator>
      <dc:date>2011-03-02T13:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with shell scripts environment variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275551#M657102</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;First, use either double or single quotes *only* to surround the whole command:&lt;BR /&gt;&lt;BR /&gt;# RUN_CMD="ls -l | grep -v -E "total|SERVER" | cut -d' ' -f1|sort -r"&lt;BR /&gt;&lt;BR /&gt;Now, do:&lt;BR /&gt;&lt;BR /&gt;# eval ${RUN_CMD}&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 02 Mar 2011 14:08:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275551#M657102</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-03-02T14:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with shell scripts environment variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275552#M657103</link>
      <description>Just had to stick a eval at the beginning of the variable while running the command&lt;BR /&gt;&lt;BR /&gt;eval ${RUN{COMMAD}&lt;BR /&gt;&lt;BR /&gt;Kaushik</description>
      <pubDate>Wed, 02 Mar 2011 15:42:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275552#M657103</guid>
      <dc:creator>kaushikbr</dc:creator>
      <dc:date>2011-03-02T15:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with shell scripts environment variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275553#M657104</link>
      <description>&amp;gt;JRF: use either double or single quotes *only* to surround the whole command:&lt;BR /&gt;&lt;BR /&gt;I assume this was an exercise for the user?&lt;BR /&gt;This works:&lt;BR /&gt;RUN_CMD="ls -l | grep -v -E 'total|SERVER' | cut -d' ' -f1 | sort -r"</description>
      <pubDate>Thu, 03 Mar 2011 04:56:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275553#M657104</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-03-03T04:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with shell scripts environment variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275554#M657105</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;This is what I have done in my script.&lt;BR /&gt;&lt;BR /&gt;RUN_CMD="ls -l ${CLUSTERS} | ${PATH_GREP} -v -E \"HOST_NAME | ${SERVER_MANAGER}\" | cut -d' ' -f1 | sort -r"&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;eval $RUN_CMD &amp;gt; ${TMP_FILE}&lt;BR /&gt;&lt;BR /&gt;This worked.&lt;BR /&gt;&lt;BR /&gt;JRF's suggestion to -&lt;BR /&gt;use either double or single quotes *only* to surround the whole command:&lt;BR /&gt;&lt;BR /&gt;also worked.&lt;BR /&gt;&lt;BR /&gt;#RUN_CMD="ls -l server02/ | grep -v -E 'total|SERVER' | cut -d' ' -f1|sort -r"&lt;BR /&gt;&lt;BR /&gt;#eval $RUN_CMD&lt;BR /&gt;&lt;BR /&gt;Once again thank you all for your suggestions.&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;K&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Mar 2011 09:56:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/issue-with-shell-scripts-environment-variable/m-p/5275554#M657105</guid>
      <dc:creator>kaushikbr</dc:creator>
      <dc:date>2011-03-03T09:56:18Z</dc:date>
    </item>
  </channel>
</rss>

