<?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: Posix Shell: shell variable evaluation in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005854#M718705</link>
    <description>Thanks everyone for the quick respone. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Not to take anything away from any of the answers but I liked Bruno's the best and was able to use incorporate the concept in my script. &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 24 Jun 2003 15:04:54 GMT</pubDate>
    <dc:creator>Peter Kain</dc:creator>
    <dc:date>2003-06-24T15:04:54Z</dc:date>
    <item>
      <title>Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005848#M718699</link>
      <description>For lack of a better term, can you double evaluate an environment variable on a single &lt;BR /&gt;line in the Posix shell. Example ... &lt;BR /&gt;&lt;BR /&gt;$ a=1 &lt;BR /&gt;$ echo $a&lt;BR /&gt;1&lt;BR /&gt;&lt;BR /&gt;$ b=a &lt;BR /&gt;$ echo $b&lt;BR /&gt;a&lt;BR /&gt;&lt;BR /&gt;I want to evaluate b so that it returns 1. &lt;BR /&gt;&lt;BR /&gt;Something like &lt;BR /&gt;   echo $($b) --returns--&amp;gt; 1 &lt;BR /&gt;&lt;BR /&gt;This way a change to "a" is reflected when evaluating b. If we now change "a" to "a=2" then evaluating b will now return 2. &lt;BR /&gt; &lt;BR /&gt;Please do not suggest "b=$a" that changes the problem. &lt;BR /&gt;Pleae no perl solutions. &lt;BR /&gt; &lt;BR /&gt;Thanks, &lt;BR /&gt;Pete</description>
      <pubDate>Tue, 24 Jun 2003 13:01:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005848#M718699</guid>
      <dc:creator>Peter Kain</dc:creator>
      <dc:date>2003-06-24T13:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005849#M718700</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;escher:root/home/root# export a=1&lt;BR /&gt;escher:root/home/root# echo $a&lt;BR /&gt;1&lt;BR /&gt;escher:root/home/root# export b=a&lt;BR /&gt;escher:root/home/root# echo $b&lt;BR /&gt;a&lt;BR /&gt;escher:root/home/root# echo $$b&lt;BR /&gt;2767b&lt;BR /&gt;escher:root/home/root# eval echo \$$b&lt;BR /&gt;1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;  Massimo&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jun 2003 13:07:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005849#M718700</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-06-24T13:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005850#M718701</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;/tmp&amp;gt; a=b&lt;BR /&gt;/tmp&amp;gt; b=1&lt;BR /&gt;tmp&amp;gt; eval echo \$$a&lt;BR /&gt;1&lt;BR /&gt;/tmp&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Best regards ...</description>
      <pubDate>Tue, 24 Jun 2003 13:10:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005850#M718701</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-06-24T13:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005851#M718702</link>
      <description>Pete,&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;# eval echo $`echo $b`&lt;BR /&gt;&lt;BR /&gt;Hai</description>
      <pubDate>Tue, 24 Jun 2003 13:10:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005851#M718702</guid>
      <dc:creator>Hai Nguyen_1</dc:creator>
      <dc:date>2003-06-24T13:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005852#M718703</link>
      <description>Hi,&lt;BR /&gt;another solution in order to avoid "\", and&lt;BR /&gt;that can be used directly in a script:&lt;BR /&gt;#a=1&lt;BR /&gt;#b=a&lt;BR /&gt;#echo $(($b))&lt;BR /&gt;1&lt;BR /&gt;#a=2&lt;BR /&gt;#echo $(($b))&lt;BR /&gt;2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cheers.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jun 2003 13:16:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005852#M718703</guid>
      <dc:creator>Bruno Vidal</dc:creator>
      <dc:date>2003-06-24T13:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005853#M718704</link>
      <description>this is for the korn shell and probably applies to the posix shell also:&lt;BR /&gt;&lt;BR /&gt;eval constructs a command by concatenating args(s) together, separating each with a space.  ksh then reads and executes this command in the current environment.  Note that command words are expanded twice; once to construct arg and again when ksh executes the constructed command.&lt;BR /&gt;&lt;BR /&gt;an example&lt;BR /&gt;&lt;BR /&gt;foo=10; x=foo&lt;BR /&gt;y='$'$x&lt;BR /&gt;print $y&lt;BR /&gt;&lt;BR /&gt;$foo&lt;BR /&gt;&lt;BR /&gt;eval y='$'$x&lt;BR /&gt;print $y&lt;BR /&gt;&lt;BR /&gt;10</description>
      <pubDate>Tue, 24 Jun 2003 13:17:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005853#M718704</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-24T13:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005854#M718705</link>
      <description>Thanks everyone for the quick respone. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Not to take anything away from any of the answers but I liked Bruno's the best and was able to use incorporate the concept in my script. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jun 2003 15:04:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005854#M718705</guid>
      <dc:creator>Peter Kain</dc:creator>
      <dc:date>2003-06-24T15:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005855#M718706</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Be careful ... It doesn't work !&lt;BR /&gt;&lt;BR /&gt;#a=1&lt;BR /&gt;#b=a&lt;BR /&gt;#echo $(($b))&lt;BR /&gt;1&lt;BR /&gt;#a=2&lt;BR /&gt;#echo $(($b))&lt;BR /&gt;2&lt;BR /&gt;#a="it doesn't work"&lt;BR /&gt;#echo $(($b))&lt;BR /&gt;sh: it doesn't work: Syntax error&lt;BR /&gt;#eval echo \$$b&lt;BR /&gt;it doesn't work&lt;BR /&gt;&lt;BR /&gt;Regards.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jun 2003 15:13:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005855#M718706</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-06-24T15:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005856#M718707</link>
      <description>/usr/dt/bin/dtksh can do this.  It is based on ksh93.  You can read the ksh93 manual with&lt;BR /&gt; man -M /usr/dt/man ksh&lt;BR /&gt;&lt;BR /&gt;% typeset -n b=a&lt;BR /&gt;% a=1&lt;BR /&gt;% echo $b&lt;BR /&gt;1&lt;BR /&gt;% a=3 &lt;BR /&gt;% echo $b&lt;BR /&gt;3&lt;BR /&gt;% b=5&lt;BR /&gt;% echo $a&lt;BR /&gt;5&lt;BR /&gt;% typeset +n b&lt;BR /&gt;% echo $b&lt;BR /&gt;a&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jun 2003 17:36:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005856#M718707</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2003-06-24T17:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Posix Shell: shell variable evaluation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005857#M718708</link>
      <description>Jean-Louis, &lt;BR /&gt;&lt;BR /&gt;I found out rigth away that you are correct. &lt;BR /&gt;As you probably realized, I had posted a simplified version of my issue. &lt;BR /&gt;&lt;BR /&gt;I ended up using what you and Massimo posted. &lt;BR /&gt;&lt;BR /&gt;eval echo \$$b &lt;BR /&gt;&lt;BR /&gt;Once again thanks everyone.</description>
      <pubDate>Tue, 01 Jul 2003 12:57:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/posix-shell-shell-variable-evaluation/m-p/3005857#M718708</guid>
      <dc:creator>Peter Kain</dc:creator>
      <dc:date>2003-07-01T12:57:19Z</dc:date>
    </item>
  </channel>
</rss>

