<?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: Conditional alias and/or command in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983910#M99888</link>
    <description>Thanks, Pete. I (could) swear I tried that on Monday (I'm bouncing back and forth between priorities). This happens to be in one of a series of shell scripts that I'm inheriting (where it has never worked).&lt;BR /&gt;&lt;BR /&gt;JM&lt;BR /&gt;</description>
    <pubDate>Thu, 08 Jun 2006 10:21:15 GMT</pubDate>
    <dc:creator>john guardian</dc:creator>
    <dc:date>2006-06-08T10:21:15Z</dc:date>
    <item>
      <title>Conditional alias and/or command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983906#M99884</link>
      <description>&lt;!--!*#--&gt;Hi. I'm using a KSH script that incorporates functions and would like to assign a command to a var CMD for execution. For example, in one function within the script, I might assign the command var CMD to be 'echo -e' while in another function, I might assign the command var CMD to be 'set -x'. Once the command is assigned a value within the confines of the called function and returns to the main body of the shell script, it would need to be able to execute CMD.&lt;BR /&gt;&lt;BR /&gt;Anyone?</description>
      <pubDate>Thu, 08 Jun 2006 08:32:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983906#M99884</guid>
      <dc:creator>john guardian</dc:creator>
      <dc:date>2006-06-08T08:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional alias and/or command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983907#M99885</link>
      <description>Joe,&lt;BR /&gt;test1()&lt;BR /&gt;{&lt;BR /&gt;var="b"&lt;BR /&gt;}&lt;BR /&gt;test2()&lt;BR /&gt;{&lt;BR /&gt;var="c"&lt;BR /&gt;}&lt;BR /&gt;var="a"&lt;BR /&gt;echo $var&lt;BR /&gt;test1&lt;BR /&gt;echo $var&lt;BR /&gt;test2&lt;BR /&gt;echo $var&lt;BR /&gt;&lt;BR /&gt;would produce&lt;BR /&gt;a&lt;BR /&gt;b&lt;BR /&gt;c</description>
      <pubDate>Thu, 08 Jun 2006 08:45:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983907#M99885</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-06-08T08:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional alias and/or command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983908#M99886</link>
      <description>Yes, what you wrote is quite true. However, consider this example:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;function cmdA ()&lt;BR /&gt;{&lt;BR /&gt;if [ $DEBUG -eq 1 ]&lt;BR /&gt;then&lt;BR /&gt;CMD='set -x'&lt;BR /&gt;else&lt;BR /&gt;CMD=':'&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;function cmdB&lt;BR /&gt;{&lt;BR /&gt;CMD='echo $$'&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;# Start of script&lt;BR /&gt;CMD=":"&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# execute cmdB&lt;BR /&gt;cmdB&lt;BR /&gt;&lt;BR /&gt;# Now execute what was assigned in cmdB&lt;BR /&gt;??????? &amp;lt;- this is what I'm interested in.&lt;BR /&gt;&lt;BR /&gt;# execute cmdA&lt;BR /&gt;DEBUG=0&lt;BR /&gt;cmdA&lt;BR /&gt;&lt;BR /&gt;# Now execute... as above&lt;BR /&gt;?????????&lt;BR /&gt;&lt;BR /&gt;# execute cmdA&lt;BR /&gt;DEBUG=1&lt;BR /&gt;cmdA&lt;BR /&gt;&lt;BR /&gt;# Now execute... as above&lt;BR /&gt;???????&lt;BR /&gt;&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;SO, what do I use in place of the ????? above.&lt;BR /&gt;&lt;BR /&gt;Should it be &lt;BR /&gt;&lt;BR /&gt;$CMD or `"$CMD"` or OR or...... maybe this will clarify what I'm actually asking.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Thu, 08 Jun 2006 09:04:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983908#M99886</guid>
      <dc:creator>john guardian</dc:creator>
      <dc:date>2006-06-08T09:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional alias and/or command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983909#M99887</link>
      <description>Joe,&lt;BR /&gt;can you please try and replace your ????? with &lt;BR /&gt;eval $CMD</description>
      <pubDate>Thu, 08 Jun 2006 09:57:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983909#M99887</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-06-08T09:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional alias and/or command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983910#M99888</link>
      <description>Thanks, Pete. I (could) swear I tried that on Monday (I'm bouncing back and forth between priorities). This happens to be in one of a series of shell scripts that I'm inheriting (where it has never worked).&lt;BR /&gt;&lt;BR /&gt;JM&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Jun 2006 10:21:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/conditional-alias-and-or-command/m-p/4983910#M99888</guid>
      <dc:creator>john guardian</dc:creator>
      <dc:date>2006-06-08T10:21:15Z</dc:date>
    </item>
  </channel>
</rss>

