<?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: Using variable to execute command... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828176#M88166</link>
    <description>Hi everybody,&lt;BR /&gt;&lt;BR /&gt;It was not a lack of respect, sorry if it has been missunderstood.&lt;BR /&gt;&lt;BR /&gt;I also want to apologize A. Clay Stephenson because his solution works properly (I did a mistake when writing the command).&lt;BR /&gt;&lt;BR /&gt;Thanx for all.&lt;BR /&gt;&lt;BR /&gt;Sebastien.</description>
    <pubDate>Fri, 18 Oct 2002 06:51:45 GMT</pubDate>
    <dc:creator>Sébastien N</dc:creator>
    <dc:date>2002-10-18T06:51:45Z</dc:date>
    <item>
      <title>Using variable to execute command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828170#M88160</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I want to do something like that :&lt;BR /&gt;CMD="cat /etc/inittab &amp;gt; /tmp/inittab"&lt;BR /&gt;$CMD&lt;BR /&gt;&lt;BR /&gt;The pb is that the "&amp;gt;" is not correctly parsed ! :-(&lt;BR /&gt;The $CMD is send to a function executing it and testing its return code.&lt;BR /&gt;&lt;BR /&gt;Does anybody know the answer ?</description>
      <pubDate>Thu, 17 Oct 2002 14:30:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828170#M88160</guid>
      <dc:creator>Sébastien N</dc:creator>
      <dc:date>2002-10-17T14:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable to execute command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828171#M88161</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Try escaping it with &lt;BR /&gt;CMD="cat /etc/inittab \&amp;gt; /tmp/inittab" &lt;BR /&gt;$CMD &lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Chris&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Oct 2002 14:32:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828171#M88161</guid>
      <dc:creator>Christopher McCray_1</dc:creator>
      <dc:date>2002-10-17T14:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable to execute command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828172#M88162</link>
      <description>CMD="cat /etc/inittab &amp;gt; /tmp/inittab"&lt;BR /&gt;&lt;BR /&gt;eval "${CMD}" &lt;BR /&gt;&lt;BR /&gt;That should fix you.&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Oct 2002 14:36:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828172#M88162</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-10-17T14:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable to execute command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828173#M88163</link>
      <description>This should work .. use $() as command substitution.&lt;BR /&gt;&lt;BR /&gt;CMD=$(cat /etc/inittab &amp;gt; /tmp/inittab) &lt;BR /&gt;$CMD &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Oct 2002 14:39:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828173#M88163</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2002-10-17T14:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable to execute command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828174#M88164</link>
      <description>Does it need to be as a variable?&lt;BR /&gt;&lt;BR /&gt;Why not create them as functions.&lt;BR /&gt;&lt;BR /&gt;cat_inittab ()&lt;BR /&gt;{&lt;BR /&gt;cat /etc/inittab &amp;gt; /tmp/inittab&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;then simply call the function.&lt;BR /&gt;&lt;BR /&gt;# call function.&lt;BR /&gt;cat_inittab&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Oct 2002 15:28:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828174#M88164</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2002-10-17T15:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable to execute command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828175#M88165</link>
      <description>Hi Sebastian,&lt;BR /&gt;&lt;BR /&gt;A "3" will show your respect towards others for their time if they couldn't solve your problem. All the answers you got so far are "something" like what you said.&lt;BR /&gt;&lt;BR /&gt;What you are executing is a command and it is to be treated with the same respect. So, you will need to do any of the following.&lt;BR /&gt;&lt;BR /&gt;1. Declare it as a function and call the function.&lt;BR /&gt;2. Do exactly what you want to do but execute the variable with "eval" call.&lt;BR /&gt;3. Put it in command substitution syntax so that the shell will understand that it is a command.&lt;BR /&gt;4. Make it as an alias and run the alias.&lt;BR /&gt;&lt;BR /&gt;alias CMD="cat /etc/inittab &amp;gt; /tmp/iniitab"&lt;BR /&gt;CMD&lt;BR /&gt;&lt;BR /&gt;The solution closest to what you need is command substitution. If you don't want to use $ substitution, I guess you can replace double quotes with backticks (the key associated with ~).&lt;BR /&gt;&lt;BR /&gt;CMD=`cat /etc/inittab &amp;gt; /tmp/inittab`&lt;BR /&gt;$CMD&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Oct 2002 19:20:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828175#M88165</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2002-10-17T19:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable to execute command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828176#M88166</link>
      <description>Hi everybody,&lt;BR /&gt;&lt;BR /&gt;It was not a lack of respect, sorry if it has been missunderstood.&lt;BR /&gt;&lt;BR /&gt;I also want to apologize A. Clay Stephenson because his solution works properly (I did a mistake when writing the command).&lt;BR /&gt;&lt;BR /&gt;Thanx for all.&lt;BR /&gt;&lt;BR /&gt;Sebastien.</description>
      <pubDate>Fri, 18 Oct 2002 06:51:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-variable-to-execute-command/m-p/2828176#M88166</guid>
      <dc:creator>Sébastien N</dc:creator>
      <dc:date>2002-10-18T06:51:45Z</dc:date>
    </item>
  </channel>
</rss>

