<?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 Bash script from SCO doesn't work under RH ES 5 in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/bash-script-from-sco-doesn-t-work-under-rh-es-5/m-p/4365388#M35361</link>
    <description>I am having a problem with one of our bash scripts we used on SCO that now don't work on our new platform RH ES 5.&lt;BR /&gt;In the following example I want INFILE to be set to the value of the last parameter that I pass to the script. Instead of this I get INFILE set to ‘1’ if I pass one parameter or ‘2’ if I pass 2 parameters to the script.&lt;BR /&gt;&lt;BR /&gt;We use this syntax on SCO Unix in many scripts.  Does anyone have any idea of a workaround or what the correct syntax should be?  &lt;BR /&gt;&lt;BR /&gt;--------------------------------------&lt;BR /&gt; &lt;BR /&gt;#! /bin/bash&lt;BR /&gt;&lt;BR /&gt;if [ "$#" != 0 ]&lt;BR /&gt;then&lt;BR /&gt;  INFILE=`eval echo $"$#"`&lt;BR /&gt;  echo $INFILE&lt;BR /&gt;fi&lt;BR /&gt;</description>
    <pubDate>Tue, 24 Feb 2009 14:44:00 GMT</pubDate>
    <dc:creator>Debbie Fleith</dc:creator>
    <dc:date>2009-02-24T14:44:00Z</dc:date>
    <item>
      <title>Bash script from SCO doesn't work under RH ES 5</title>
      <link>https://community.hpe.com/t5/operating-system-linux/bash-script-from-sco-doesn-t-work-under-rh-es-5/m-p/4365388#M35361</link>
      <description>I am having a problem with one of our bash scripts we used on SCO that now don't work on our new platform RH ES 5.&lt;BR /&gt;In the following example I want INFILE to be set to the value of the last parameter that I pass to the script. Instead of this I get INFILE set to ‘1’ if I pass one parameter or ‘2’ if I pass 2 parameters to the script.&lt;BR /&gt;&lt;BR /&gt;We use this syntax on SCO Unix in many scripts.  Does anyone have any idea of a workaround or what the correct syntax should be?  &lt;BR /&gt;&lt;BR /&gt;--------------------------------------&lt;BR /&gt; &lt;BR /&gt;#! /bin/bash&lt;BR /&gt;&lt;BR /&gt;if [ "$#" != 0 ]&lt;BR /&gt;then&lt;BR /&gt;  INFILE=`eval echo $"$#"`&lt;BR /&gt;  echo $INFILE&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Feb 2009 14:44:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/bash-script-from-sco-doesn-t-work-under-rh-es-5/m-p/4365388#M35361</guid>
      <dc:creator>Debbie Fleith</dc:creator>
      <dc:date>2009-02-24T14:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Bash script from SCO doesn't work under RH ES 5</title>
      <link>https://community.hpe.com/t5/operating-system-linux/bash-script-from-sco-doesn-t-work-under-rh-es-5/m-p/4365389#M35362</link>
      <description>Your variables are getting interpolated multiple times and in the wrong order, so it's trying to expand $" as a variable too early. You need to escape the first dollar sign:&lt;BR /&gt;&lt;BR /&gt;INFILE=`eval echo \\$"$#"`&lt;BR /&gt;&lt;BR /&gt;But I think you could probably make it a little simpler with something like this:&lt;BR /&gt;&lt;BR /&gt;eval INFILE="\$$#"&lt;BR /&gt;&lt;BR /&gt;The different behaviors may be caused by different versions of bash. Newer versions are more strictly POSIX-compliant.</description>
      <pubDate>Tue, 24 Feb 2009 16:34:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/bash-script-from-sco-doesn-t-work-under-rh-es-5/m-p/4365389#M35362</guid>
      <dc:creator>Heironimus</dc:creator>
      <dc:date>2009-02-24T16:34:56Z</dc:date>
    </item>
  </channel>
</rss>

