<?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: Shell scripting - Storing command output in a variable in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315381#M683160</link>
    <description>If you are happy with the answers, please read the following about assigning points:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;</description>
    <pubDate>Sun, 30 Nov 2008 08:45:16 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-11-30T08:45:16Z</dc:date>
    <item>
      <title>Shell scripting - Storing command output in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315378#M683157</link>
      <description>I am making a tool with shell script to report utilization. In the script, i am storing some command output in a variable. At the end of the script, i am printing the o/p stored in the variable. But it prints the varaible not exactly as the output of the actual command. In other words, it prints everything in single line one after after other. &lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;Command output:&lt;BR /&gt;$ lspv | grep active | grep 15&lt;BR /&gt;hdiskpower15    0000792a05830e15                    Ora0600         active&lt;BR /&gt;hdiskpower115   0000792a9c882ece                    Ora0600         active&lt;BR /&gt;&lt;BR /&gt;$ opt_cmd=`lspv | grep active | grep 15`&lt;BR /&gt;&lt;BR /&gt;$ echo $opt_cmd&lt;BR /&gt;hdiskpower15 0000792a05830e15 Ora0600 active hdiskpower115 0000792a9c882ece Ora0600 active&lt;BR /&gt;&lt;BR /&gt;Can someone tell me is there any way i can store the output to a varibale exactly same as the command output.</description>
      <pubDate>Sun, 30 Nov 2008 08:13:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315378#M683157</guid>
      <dc:creator>vinna</dc:creator>
      <dc:date>2008-11-30T08:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting - Storing command output in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315379#M683158</link>
      <description>Have you tried: echo "$opt_cmd"?&lt;BR /&gt;&lt;BR /&gt;Otherwise you'll need to save the output in a file:&lt;BR /&gt;lspv | grep active | grep 15 &amp;gt; output&lt;BR /&gt;opt_cmd=$(&amp;lt; output)</description>
      <pubDate>Sun, 30 Nov 2008 08:27:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315379#M683158</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-11-30T08:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting - Storing command output in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315380#M683159</link>
      <description>I tried with "$opt_cmd". It works. Thanks</description>
      <pubDate>Sun, 30 Nov 2008 08:31:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315380#M683159</guid>
      <dc:creator>vinna</dc:creator>
      <dc:date>2008-11-30T08:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting - Storing command output in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315381#M683160</link>
      <description>If you are happy with the answers, please read the following about assigning points:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;</description>
      <pubDate>Sun, 30 Nov 2008 08:45:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315381#M683160</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-11-30T08:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting - Storing command output in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315382#M683161</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You have to love these postings from AIX environments (not that it matters for this question) :-)  I guess is shows how valuable a place the ITRC can be.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 30 Nov 2008 13:28:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315382#M683161</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-11-30T13:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Shell scripting - Storing command output in a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315383#M683162</link>
      <description>&amp;gt; [...] I guess is shows how valuable a place&lt;BR /&gt;&amp;gt; the ITRC can be.&lt;BR /&gt;&lt;BR /&gt;Or how thoroughly lost and confused its users&lt;BR /&gt;can be.</description>
      <pubDate>Sun, 30 Nov 2008 18:22:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-storing-command-output-in-a-variable/m-p/4315383#M683162</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-11-30T18:22:32Z</dc:date>
    </item>
  </channel>
</rss>

