<?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 Script problems attributing variables in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532090#M869264</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I?m making a script to send several emails and the addresses are defined as variables. The problem is that I?m trying to use a single line for the email part but it?s not working. This part of the script is like this:&lt;BR /&gt;&lt;BR /&gt;export NUM=3 #number of email addresses&lt;BR /&gt;export EMAIL1=test1@test.com&lt;BR /&gt;export EMAIL2=test2@test.com&lt;BR /&gt;export EMAIL3=test3@test.com&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;while [ $NUM -ne 0 ]&lt;BR /&gt;do&lt;BR /&gt;EMAIL="EMAIL$NUM"&lt;BR /&gt;echo test | mailx -s"test subject" $EMAIL&lt;BR /&gt;let "NUM = NUM - 1"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;The $EMAIL shows EMAIL1, EMAIL2 and EMAIL3 but I wanted it to assume the real email addresses. &lt;BR /&gt;&lt;BR /&gt;I asked a friend who works with java script and he told me to use arrays. Do we have that for shell scripting ??&lt;BR /&gt;&lt;BR /&gt;Does anybody now how to do it in any way ??&lt;BR /&gt;</description>
    <pubDate>Wed, 23 May 2001 17:49:02 GMT</pubDate>
    <dc:creator>Guilherme Belinelo</dc:creator>
    <dc:date>2001-05-23T17:49:02Z</dc:date>
    <item>
      <title>Script problems attributing variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532090#M869264</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I?m making a script to send several emails and the addresses are defined as variables. The problem is that I?m trying to use a single line for the email part but it?s not working. This part of the script is like this:&lt;BR /&gt;&lt;BR /&gt;export NUM=3 #number of email addresses&lt;BR /&gt;export EMAIL1=test1@test.com&lt;BR /&gt;export EMAIL2=test2@test.com&lt;BR /&gt;export EMAIL3=test3@test.com&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;while [ $NUM -ne 0 ]&lt;BR /&gt;do&lt;BR /&gt;EMAIL="EMAIL$NUM"&lt;BR /&gt;echo test | mailx -s"test subject" $EMAIL&lt;BR /&gt;let "NUM = NUM - 1"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;The $EMAIL shows EMAIL1, EMAIL2 and EMAIL3 but I wanted it to assume the real email addresses. &lt;BR /&gt;&lt;BR /&gt;I asked a friend who works with java script and he told me to use arrays. Do we have that for shell scripting ??&lt;BR /&gt;&lt;BR /&gt;Does anybody now how to do it in any way ??&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2001 17:49:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532090#M869264</guid>
      <dc:creator>Guilherme Belinelo</dc:creator>
      <dc:date>2001-05-23T17:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Script problems attributing variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532091#M869265</link>
      <description>getting too fancy for me.&lt;BR /&gt;&lt;BR /&gt;Would an alias work as well, or do you need to have some sort of conditional logic to determine which addresses to send to?&lt;BR /&gt;&lt;BR /&gt;If the list is static, then there'd be no need to invent fancy variables.&lt;BR /&gt;&lt;BR /&gt;Alternatively, would it work as well to employ a case statement in place of your do/done?&lt;BR /&gt;&lt;BR /&gt;Just a thought.</description>
      <pubDate>Wed, 23 May 2001 17:58:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532091#M869265</guid>
      <dc:creator>Mark Fenton</dc:creator>
      <dc:date>2001-05-23T17:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Script problems attributing variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532092#M869266</link>
      <description>Mark,&lt;BR /&gt;&lt;BR /&gt;The email list is static and I don?t need to use any logic to determine the addresses. Actually it shold be very simple but I don?t know how to do it.&lt;BR /&gt;&lt;BR /&gt;Can you send me some example using alias ? It could help a lot once I don?t know how to use it.&lt;BR /&gt;&lt;BR /&gt;Tks,&lt;BR /&gt;&lt;BR /&gt;Guilherme Belinelo&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2001 18:18:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532092#M869266</guid>
      <dc:creator>Guilherme Belinelo</dc:creator>
      <dc:date>2001-05-23T18:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Script problems attributing variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532093#M869267</link>
      <description>Guilherme,&lt;BR /&gt;&lt;BR /&gt;I took your script and modified it to use an array.  Here is what it looks like:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh                                  &lt;BR /&gt;                                           &lt;BR /&gt;export NUM=3 #number of email addresses    &lt;BR /&gt;export EMAIL[1]=test1@test.com             &lt;BR /&gt;export EMAIL[2]=test2@test.com             &lt;BR /&gt;export EMAIL[3]=test3@test.com             &lt;BR /&gt;                                           &lt;BR /&gt;                                           &lt;BR /&gt;while [ $NUM -ne 0 ]                       &lt;BR /&gt;do                                         &lt;BR /&gt;EMAIL="EMAIL$NUM"                          &lt;BR /&gt;#echo test | mailx -s"test subject" $EMAIL &lt;BR /&gt;echo "EMAIL[$NUM] = ${EMAIL[$NUM]}"         &lt;BR /&gt;let "NUM = NUM - 1"                        &lt;BR /&gt;done                                       &lt;BR /&gt;&lt;BR /&gt;I remarked out the line that does the 'mailx', just for testing purposes, and I put in a line to echo the value of the EMAIL array variable.  When I run it, here is the output:&lt;BR /&gt;&lt;BR /&gt;EMAIL[3] = test3@test.com&lt;BR /&gt;EMAIL[2] = test2@test.com&lt;BR /&gt;EMAIL[1] = test1@test.com&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Does this help?  Also, for the 'mailx' command you can specify the e-mail addresses separated by commas.  This means you can create one variable with all the addresses in it and use it something like this:&lt;BR /&gt;&lt;BR /&gt;EMAIL="test1@test.com, test2@test.com, test3@test.com"&lt;BR /&gt;&lt;BR /&gt;echo test | mailx -s"Test subject" $EMAIL&lt;BR /&gt;&lt;BR /&gt;I hope that helps.&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2001 18:21:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532093#M869267</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2001-05-23T18:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script problems attributing variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532094#M869268</link>
      <description>If you had the list of email addresses in a file, you could&lt;BR /&gt;&lt;BR /&gt;cat emaillist | xargs -n1 mailx -s "mysubject"&lt;BR /&gt;&lt;BR /&gt;This would run mailx for each line in emaillist, appending the line on the end of the mailx command.</description>
      <pubDate>Wed, 23 May 2001 18:22:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-problems-attributing-variables/m-p/2532094#M869268</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2001-05-23T18:22:41Z</dc:date>
    </item>
  </channel>
</rss>

