<?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: shell script to mail data file not including data in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522320#M220085</link>
    <description>Let's try this again...didn't include all the particulars last time.  The data file is there, with data in it.&lt;BR /&gt;&lt;BR /&gt;#dest=username@emailaddress&lt;BR /&gt;&lt;BR /&gt;if [ -f /home/robinson/file* ]&lt;BR /&gt;  then&lt;BR /&gt;cd /home/robinson&lt;BR /&gt;for file in `ls file*`&lt;BR /&gt;do&lt;BR /&gt;   /usr/contrib/bin/gzip -c $file &amp;gt; ${file}.gz&lt;BR /&gt;   echo "[include ${file}.gz application/octet-stream base64]" &amp;gt; ${file}.gz.uu&lt;BR /&gt;   elm -s "Subject - $file" $dest &amp;lt; ${file}.gz.uu&lt;BR /&gt;&lt;BR /&gt;   rm -f ${file}.gz&lt;BR /&gt;   rm -f ${file}.gz.uu&lt;BR /&gt;   mv /home/robinson/file1 /bkup&lt;BR /&gt;   exit&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;fi&lt;BR /&gt;</description>
    <pubDate>Mon, 11 Apr 2005 13:47:24 GMT</pubDate>
    <dc:creator>Joe Robinson_2</dc:creator>
    <dc:date>2005-04-11T13:47:24Z</dc:date>
    <item>
      <title>shell script to mail data file not including data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522315#M220080</link>
      <description>I'm using the following shell to grab a data file and email it to another office.  For some reason I can't explain, it recently stopped including the data file and just sends a blank email.  I'd be grateful for a tip what the problem on this might be...&lt;BR /&gt;&lt;BR /&gt;dest=username@email address&lt;BR /&gt;  if [ -f /home/robinson/myfile* ]&lt;BR /&gt;    then&lt;BR /&gt;      cd /home/robinson&lt;BR /&gt;      for file in `ls myfile*`&lt;BR /&gt;      do&lt;BR /&gt;      /usr/contrib/bin/gzip -c $file &amp;gt; ${file}.gz&lt;BR /&gt;echo "[include ${file}.gz application/octet-stream base64]" &amp;gt; ${file}.gz.uu&lt;BR /&gt;&lt;BR /&gt; elm -s "Subject - $file" $dest &amp;lt; ${file}.gz.uu&lt;BR /&gt;&lt;BR /&gt;     rm -f ${file}.gz&lt;BR /&gt;     rm -f ${file}.gz.uu&lt;BR /&gt;&lt;BR /&gt;     exit&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Apr 2005 13:28:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522315#M220080</guid>
      <dc:creator>Joe Robinson_2</dc:creator>
      <dc:date>2005-04-11T13:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to mail data file not including data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522316#M220081</link>
      <description>ll  /home/robinson/myfile*&lt;BR /&gt;&lt;BR /&gt;Do you have that file?? and more than zero bytes??</description>
      <pubDate>Mon, 11 Apr 2005 13:32:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522316#M220081</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-04-11T13:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to mail data file not including data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522317#M220082</link>
      <description>One obvious mistake is, there is no "done" for &lt;BR /&gt;the "for" loop. The syntax for "for" loop is:&lt;BR /&gt;&lt;BR /&gt;for file in ....&lt;BR /&gt;do&lt;BR /&gt;....&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;You don't get any syntax error because of "exit".&lt;BR /&gt;&lt;BR /&gt;- Biswajit&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Apr 2005 13:34:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522317#M220082</guid>
      <dc:creator>Biswajit Tripathy</dc:creator>
      <dc:date>2005-04-11T13:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to mail data file not including data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522318#M220083</link>
      <description>&lt;BR /&gt;The best way to send files is with uuencode:&lt;BR /&gt;&lt;BR /&gt;for i in `echo filename1 filename2 filename3 ...` do uuencode $i $i.txt&lt;BR /&gt;done|mailx -m -s "test" username@whereever.com&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry d brown jr&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Apr 2005 13:34:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522318#M220083</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2005-04-11T13:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to mail data file not including data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522319#M220084</link>
      <description>I suspect that you have a timing problem. The file is being removed before elm can process it. It would be a bit more apparent if you included siome text in your mail before the [include] clause.</description>
      <pubDate>Mon, 11 Apr 2005 13:35:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522319#M220084</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-04-11T13:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to mail data file not including data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522320#M220085</link>
      <description>Let's try this again...didn't include all the particulars last time.  The data file is there, with data in it.&lt;BR /&gt;&lt;BR /&gt;#dest=username@emailaddress&lt;BR /&gt;&lt;BR /&gt;if [ -f /home/robinson/file* ]&lt;BR /&gt;  then&lt;BR /&gt;cd /home/robinson&lt;BR /&gt;for file in `ls file*`&lt;BR /&gt;do&lt;BR /&gt;   /usr/contrib/bin/gzip -c $file &amp;gt; ${file}.gz&lt;BR /&gt;   echo "[include ${file}.gz application/octet-stream base64]" &amp;gt; ${file}.gz.uu&lt;BR /&gt;   elm -s "Subject - $file" $dest &amp;lt; ${file}.gz.uu&lt;BR /&gt;&lt;BR /&gt;   rm -f ${file}.gz&lt;BR /&gt;   rm -f ${file}.gz.uu&lt;BR /&gt;   mv /home/robinson/file1 /bkup&lt;BR /&gt;   exit&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Apr 2005 13:47:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522320#M220085</guid>
      <dc:creator>Joe Robinson_2</dc:creator>
      <dc:date>2005-04-11T13:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to mail data file not including data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522321#M220086</link>
      <description>Hi,&lt;BR /&gt;try running your script like this:&lt;BR /&gt;# sh -x &lt;YOUR_SCRIPT&gt;&lt;/YOUR_SCRIPT&gt;and post the output.&lt;BR /&gt;&lt;BR /&gt;Btw: do not use "for file" as "file" is also a command.&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Apr 2005 14:25:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522321#M220086</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-04-11T14:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to mail data file not including data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522322#M220087</link>
      <description>I would change the script to this:&lt;BR /&gt;&lt;BR /&gt;cd /home/robinson&lt;BR /&gt;for file in `ls file*`&lt;BR /&gt;do&lt;BR /&gt;if  [ -s $file ]&lt;BR /&gt;then&lt;BR /&gt;/usr/contrib/bin/gzip -c $file &amp;gt; ${file}.gz&lt;BR /&gt;echo "[include ${file}.gz application/octet-stream base64]" &amp;gt; ${file}.gz.uu&lt;BR /&gt;elm -s "Subject - $file" $dest &amp;lt; ${file}.gz.uu&lt;BR /&gt;sleep 3&lt;BR /&gt;rm -f ${file}.gz&lt;BR /&gt;rm -f ${file}.gz.uu&lt;BR /&gt;mv /home/robinson/file1 /bkup&lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;The "sleep 3" should take care of Clay &lt;BR /&gt;Stephenson's suggestion that it might be timing&lt;BR /&gt;issue. You could remove it later if that turns out&lt;BR /&gt;to be a non-issue.&lt;BR /&gt;&lt;BR /&gt;I'm not sure [ -f /home/robinson/file* ] is a good &lt;BR /&gt;idea as -f expects a single file name.&lt;BR /&gt;&lt;BR /&gt;- Biswajit&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Apr 2005 14:37:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522322#M220087</guid>
      <dc:creator>Biswajit Tripathy</dc:creator>
      <dc:date>2005-04-11T14:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to mail data file not including data</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522323#M220088</link>
      <description>I'll stick with my original answer. I assumed the exit statement was a typo for done.&lt;BR /&gt;&lt;BR /&gt;I think the included file is being unlinked before elm can read it. Remember, the include is a directive to read an external file. It's possible that elm has simply queued the mail job at this point but not processed the include statement.&lt;BR /&gt;&lt;BR /&gt;Consider this ananlogous situation:&lt;BR /&gt;lp -dmyprinter myfile&lt;BR /&gt;rm myfile&lt;BR /&gt;&lt;BR /&gt;It's possible that myfile will never be printed because though the printjob has been scheduled; it hasnt actually starter reading the file. On the other hand:&lt;BR /&gt;lp -dmyprinter -c myfile&lt;BR /&gt;OR&lt;BR /&gt;cat myfile | lp -dmyprinter&lt;BR /&gt;rm myfile&lt;BR /&gt;&lt;BR /&gt;will work everytime because the file is either copied or is piped to the lp command before it can be used.&lt;BR /&gt;&lt;BR /&gt;Again, I can't tell from your blank email but it would be a good idea to incluse some text before and after your [include] clause so that it would be very obvious what is happening.</description>
      <pubDate>Mon, 11 Apr 2005 15:55:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-mail-data-file-not-including-data/m-p/3522323#M220088</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-04-11T15:55:52Z</dc:date>
    </item>
  </channel>
</rss>

