<?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: Korn Shell array syntax in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-array-syntax/m-p/2985674#M123230</link>
    <description>Greg,&lt;BR /&gt;&lt;BR /&gt;Here it is - take an idea from the line str='...' -&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;$ cat k.sh&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;set -A array `cut -d: -f1 /etc/passwd`&lt;BR /&gt;&lt;BR /&gt;a="array" # setting array&lt;BR /&gt;&lt;BR /&gt;str='${'$a'[@]}'&lt;BR /&gt;&lt;BR /&gt;eval echo ${str[@]}&lt;BR /&gt;&amp;lt;&amp;lt;&lt;BR /&gt;&lt;BR /&gt;To reference all element in a ksh-style array, use ${array[@]} not ${array}[@].&lt;BR /&gt;&lt;BR /&gt;HTH.&lt;BR /&gt;- ramd.&lt;BR /&gt;</description>
    <pubDate>Sat, 31 May 2003 09:04:09 GMT</pubDate>
    <dc:creator>Ramkumar Devanathan</dc:creator>
    <dc:date>2003-05-31T09:04:09Z</dc:date>
    <item>
      <title>Korn Shell array syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-array-syntax/m-p/2985673#M123229</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;If anyone can answer this it would be here.  So, here is the question:&lt;BR /&gt;&lt;BR /&gt;I have a script in which I set up numerous arrays.  To make a long story short, I am trying to create a function (to be later used repeatedly inside of a long case statement) in which I refer to an array by using a scalar variable.  Like so,&lt;BR /&gt;&lt;BR /&gt;function FunctionName&lt;BR /&gt;{&lt;BR /&gt;  echo "${$variable}[@]"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;What I am trying to do is echo all the elements of the array determined by $variable. The shell is not letting me do this, no matter how I quote it, or add more braces, etc.  &lt;BR /&gt;&lt;BR /&gt;I know this might sound like giberish the way I am explaining it. Can anyone help? &lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;greg</description>
      <pubDate>Sat, 31 May 2003 07:15:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-array-syntax/m-p/2985673#M123229</guid>
      <dc:creator>Greg Pierro</dc:creator>
      <dc:date>2003-05-31T07:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Korn Shell array syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-array-syntax/m-p/2985674#M123230</link>
      <description>Greg,&lt;BR /&gt;&lt;BR /&gt;Here it is - take an idea from the line str='...' -&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;$ cat k.sh&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;set -A array `cut -d: -f1 /etc/passwd`&lt;BR /&gt;&lt;BR /&gt;a="array" # setting array&lt;BR /&gt;&lt;BR /&gt;str='${'$a'[@]}'&lt;BR /&gt;&lt;BR /&gt;eval echo ${str[@]}&lt;BR /&gt;&amp;lt;&amp;lt;&lt;BR /&gt;&lt;BR /&gt;To reference all element in a ksh-style array, use ${array[@]} not ${array}[@].&lt;BR /&gt;&lt;BR /&gt;HTH.&lt;BR /&gt;- ramd.&lt;BR /&gt;</description>
      <pubDate>Sat, 31 May 2003 09:04:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-array-syntax/m-p/2985674#M123230</guid>
      <dc:creator>Ramkumar Devanathan</dc:creator>
      <dc:date>2003-05-31T09:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Korn Shell array syntax</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-array-syntax/m-p/2985675#M123231</link>
      <description>Thanks.  Looks good.  I assigned you 10 points but the drop down flipped back to 8 for some reason.  I must have double clutched.  The eval command was what I needed.</description>
      <pubDate>Wed, 04 Jun 2003 23:12:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/korn-shell-array-syntax/m-p/2985675#M123231</guid>
      <dc:creator>Greg Pierro</dc:creator>
      <dc:date>2003-06-04T23:12:32Z</dc:date>
    </item>
  </channel>
</rss>

