<?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: Assign $VAR to an array in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163063#M684773</link>
    <description>all examples look good and I can use variations of them all further in my script - thanks all&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris,</description>
    <pubDate>Fri, 13 Mar 2009 08:33:22 GMT</pubDate>
    <dc:creator>lawrenzo_1</dc:creator>
    <dc:date>2009-03-13T08:33:22Z</dc:date>
    <item>
      <title>Assign $VAR to an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163059#M684769</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I want to assign the following variables to an array but not sure if this would be the correct solution ....&lt;BR /&gt;&lt;BR /&gt;I have a set of commands to run to configure and application and depending on how many $VAR will depend on the command to execute:&lt;BR /&gt;&lt;BR /&gt;the variables in a seperate config file are:&lt;BR /&gt;&lt;BR /&gt;ECM_SOAP=443&lt;BR /&gt;ECM_HTTP=7080&lt;BR /&gt;ECM_HTTP=7090&lt;BR /&gt;ECM_MAPPORT1=7843&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;in the script I have the following command:&lt;BR /&gt;&lt;BR /&gt;dscontrol port add ${SERVICE}_CLUST:7090+7080+7843+443 method nat reset no&lt;BR /&gt;&lt;BR /&gt;the problem is when I run the command in a loop to configure another environment:&lt;BR /&gt;&lt;BR /&gt;(from the config file) &lt;BR /&gt;&lt;BR /&gt;SIG_SOAP=444&lt;BR /&gt;SIG_HTTP=7180&lt;BR /&gt;SIG_HTTP=7190&lt;BR /&gt;SIG_MAPPORT1=7844&lt;BR /&gt;SIG_MAPPORT2=7944&lt;BR /&gt;&lt;BR /&gt;how can I take these variables and execute the command &lt;BR /&gt;&lt;BR /&gt;dscontrol port add ${SERVICE}_CLUST:&lt;PORTS&gt; method nat reset no&lt;BR /&gt;&lt;BR /&gt;thanks for any help!&lt;BR /&gt;&lt;BR /&gt;chris&lt;/PORTS&gt;</description>
      <pubDate>Thu, 12 Mar 2009 15:37:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163059#M684769</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2009-03-12T15:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Assign $VAR to an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163060#M684770</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;TO assign variables to an array you can do:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo "Enter a series of space-delimited fields to populate ARY"&lt;BR /&gt;read LINE&lt;BR /&gt;set -A ARY ${LINE}&lt;BR /&gt;echo "${#ARY[*]} elements exist"&lt;BR /&gt;echo "element_0 = ${ARY[0]}"&lt;BR /&gt;echo "element_1 = ${ARY[1]}"&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 12 Mar 2009 15:54:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163060#M684770</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-03-12T15:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Assign $VAR to an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163061#M684771</link>
      <description>Would the following work?&lt;BR /&gt;&lt;BR /&gt;Config file:&lt;BR /&gt;SOAP=443&lt;BR /&gt;HTTP1=7080&lt;BR /&gt;HTTP2=7090&lt;BR /&gt;MAPPORT1=7843&lt;BR /&gt;&lt;BR /&gt;Script:&lt;BR /&gt;. fullpath/config_file&lt;BR /&gt;&lt;BR /&gt;dscontrol port add ${SERVICE}_CLUST:$HTTP2+$HTTP1+$MAPPORT1+$SOAP method nat reset no&lt;BR /&gt;&lt;BR /&gt;This takes the port settings from the config file, and applies them to the script. You may consider using a variable for SERVICE in the config file.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Mar 2009 01:25:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163061#M684771</guid>
      <dc:creator>George Spencer_4</dc:creator>
      <dc:date>2009-03-13T01:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Assign $VAR to an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163062#M684772</link>
      <description>a little more flexible:&lt;BR /&gt;&lt;BR /&gt;PORTS=`egrep "HTTP|MAPPORT|SOAP" configfile \&lt;BR /&gt;| awk -F= '{if (ports=="") {ports=$2}&lt;BR /&gt;else {ports=ports"+"$2}&lt;BR /&gt;} END{print ports}'`&lt;BR /&gt;dscontrol port add $SERVICE_CLUST:$PORTS method nat reset no&lt;BR /&gt;&lt;BR /&gt;egrep looks for all HTTP, MAPPORT and SOAP lines in your configfile&lt;BR /&gt;awk uses "=" as delimiter and adds the ports in one line. So you can have as many ports as you like in your configfile.</description>
      <pubDate>Fri, 13 Mar 2009 07:40:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163062#M684772</guid>
      <dc:creator>Matthias Zander</dc:creator>
      <dc:date>2009-03-13T07:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Assign $VAR to an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163063#M684773</link>
      <description>all examples look good and I can use variations of them all further in my script - thanks all&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris,</description>
      <pubDate>Fri, 13 Mar 2009 08:33:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/assign-var-to-an-array/m-p/5163063#M684773</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2009-03-13T08:33:22Z</dc:date>
    </item>
  </channel>
</rss>

