<?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 help needed in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed/m-p/4006957#M96235</link>
    <description>OK...let me see if I can even explain what I'm trying to do here...&lt;BR /&gt;&lt;BR /&gt;I have a file (file1) that gets generated with a list in it like so..&lt;BR /&gt;&lt;BR /&gt;ABC&lt;BR /&gt;DEF&lt;BR /&gt;GHI&lt;BR /&gt;&lt;BR /&gt;I have another file (file2) with variables in it like so...&lt;BR /&gt;&lt;BR /&gt;BOB="bob@mail.com"&lt;BR /&gt;ABC="$BOB"&lt;BR /&gt;&lt;BR /&gt;I am wanting to write a script to do something like this...&lt;BR /&gt;&lt;BR /&gt;. /file2&lt;BR /&gt;while read ENTRY&lt;BR /&gt;do&lt;BR /&gt;grep "$ENTRY" /tmp/filegenfromanotherscript &amp;gt; /tmp/new&lt;BR /&gt;FILE=/tmp/new&lt;BR /&gt;LIST=$(cat /tmp/new)&lt;BR /&gt;if [[ -s ${FILE} ]]; then&lt;BR /&gt;cat &amp;lt;&lt;EOM&gt; /tmp/mail.msg&lt;BR /&gt;    Here's my message&lt;BR /&gt;$LIST&lt;BR /&gt;EOM&lt;BR /&gt;(echo "Subject: This is it"&lt;BR /&gt;cat /tmp/mail.msg&lt;BR /&gt;) | rmail RIGHT HERE IS THE PROBLEM&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt; /tmp/file1&lt;BR /&gt;&lt;BR /&gt;What I am wanting to do is this:  The ENTRY variable will be the same as list in file1 (ie. ABC, DEF, etc).  I want to be able to have the script use the ENTRY variable, find that variable in file2 and then send the email to the appropriate address.&lt;BR /&gt;&lt;BR /&gt;File1 is generated regularly and cannot change.  Filegenfromanotherscript is fixed (this is just a file with a listing of things I am grepping information from.  This file is generated regularly too)&lt;BR /&gt;&lt;BR /&gt;How can I write this script to accomplish what I am trying to do?  Thanks for the help.&lt;BR /&gt;&lt;/EOM&gt;</description>
    <pubDate>Thu, 24 May 2007 21:33:34 GMT</pubDate>
    <dc:creator>TheJuiceman</dc:creator>
    <dc:date>2007-05-24T21:33:34Z</dc:date>
    <item>
      <title>Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed/m-p/4006957#M96235</link>
      <description>OK...let me see if I can even explain what I'm trying to do here...&lt;BR /&gt;&lt;BR /&gt;I have a file (file1) that gets generated with a list in it like so..&lt;BR /&gt;&lt;BR /&gt;ABC&lt;BR /&gt;DEF&lt;BR /&gt;GHI&lt;BR /&gt;&lt;BR /&gt;I have another file (file2) with variables in it like so...&lt;BR /&gt;&lt;BR /&gt;BOB="bob@mail.com"&lt;BR /&gt;ABC="$BOB"&lt;BR /&gt;&lt;BR /&gt;I am wanting to write a script to do something like this...&lt;BR /&gt;&lt;BR /&gt;. /file2&lt;BR /&gt;while read ENTRY&lt;BR /&gt;do&lt;BR /&gt;grep "$ENTRY" /tmp/filegenfromanotherscript &amp;gt; /tmp/new&lt;BR /&gt;FILE=/tmp/new&lt;BR /&gt;LIST=$(cat /tmp/new)&lt;BR /&gt;if [[ -s ${FILE} ]]; then&lt;BR /&gt;cat &amp;lt;&lt;EOM&gt; /tmp/mail.msg&lt;BR /&gt;    Here's my message&lt;BR /&gt;$LIST&lt;BR /&gt;EOM&lt;BR /&gt;(echo "Subject: This is it"&lt;BR /&gt;cat /tmp/mail.msg&lt;BR /&gt;) | rmail RIGHT HERE IS THE PROBLEM&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt; /tmp/file1&lt;BR /&gt;&lt;BR /&gt;What I am wanting to do is this:  The ENTRY variable will be the same as list in file1 (ie. ABC, DEF, etc).  I want to be able to have the script use the ENTRY variable, find that variable in file2 and then send the email to the appropriate address.&lt;BR /&gt;&lt;BR /&gt;File1 is generated regularly and cannot change.  Filegenfromanotherscript is fixed (this is just a file with a listing of things I am grepping information from.  This file is generated regularly too)&lt;BR /&gt;&lt;BR /&gt;How can I write this script to accomplish what I am trying to do?  Thanks for the help.&lt;BR /&gt;&lt;/EOM&gt;</description>
      <pubDate>Thu, 24 May 2007 21:33:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed/m-p/4006957#M96235</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2007-05-24T21:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed/m-p/4006958#M96236</link>
      <description>&lt;!--!*#--&gt;Hmm... you need to expand variables named by other variables, so you're going to need "eval" for that. You may also need the variables of file2 exported, so that sub-shells can read them.&lt;BR /&gt;&lt;BR /&gt;Let me try to re-write your script...&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;set -a # auto-export all variables after this&lt;BR /&gt;. /file2&lt;BR /&gt;set +a # stop auto-export&lt;BR /&gt;&lt;BR /&gt;while read ENTRY&lt;BR /&gt;do&lt;BR /&gt;    ADDRESS=$(eval echo \$$ENTRY)&lt;BR /&gt;    LIST=$(grep "$ENTRY" /tmp/filegenfromanotherscript)&lt;BR /&gt;    if [ "$LIST" != "" ]; then&lt;BR /&gt;        cat &amp;lt;&amp;lt; EOM | mail -s "This is it" $ADDRESS&lt;BR /&gt;Here's my message&lt;BR /&gt;$LIST&lt;BR /&gt;EOM&lt;BR /&gt;    fi&lt;BR /&gt;done &amp;lt; /tmp/file1&lt;BR /&gt;&lt;BR /&gt;... hmm, I think I got rid of most of those temporary files :-)&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Fri, 25 May 2007 01:54:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed/m-p/4006958#M96236</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2007-05-25T01:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed/m-p/4006959#M96237</link>
      <description>I appreciate the help.  However, I cannot seem to get your script to work.  Any thoughts?  Thanks.</description>
      <pubDate>Tue, 29 May 2007 22:02:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed/m-p/4006959#M96237</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2007-05-29T22:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed/m-p/4006960#M96238</link>
      <description>Actually, with a little changing I got it to do what I want.  Thank you very much!!!  Please repost a reply so I can give you more points.  Thanks!!!</description>
      <pubDate>Tue, 29 May 2007 22:47:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed/m-p/4006960#M96238</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2007-05-29T22:47:40Z</dc:date>
    </item>
  </channel>
</rss>

