<?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 Checking a file for content in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042319#M95817</link>
    <description>Hey gang,&lt;BR /&gt;&lt;BR /&gt;Here's what I'm trying to do.  I am populating a file with information.  I am then mailing the contents of the file.  However, I only want to send the mail if there is actual content in the file.  I do not want to send an email if there is nothing in the file.  How can I check the file and have the script exit if the file is empty?  Thanks.</description>
    <pubDate>Tue, 24 Apr 2007 19:39:06 GMT</pubDate>
    <dc:creator>TheJuiceman</dc:creator>
    <dc:date>2007-04-24T19:39:06Z</dc:date>
    <item>
      <title>Checking a file for content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042319#M95817</link>
      <description>Hey gang,&lt;BR /&gt;&lt;BR /&gt;Here's what I'm trying to do.  I am populating a file with information.  I am then mailing the contents of the file.  However, I only want to send the mail if there is actual content in the file.  I do not want to send an email if there is nothing in the file.  How can I check the file and have the script exit if the file is empty?  Thanks.</description>
      <pubDate>Tue, 24 Apr 2007 19:39:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042319#M95817</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2007-04-24T19:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Checking a file for content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042320#M95818</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# [ -s "${FILE}" ] &amp;amp;&amp;amp; mailx -s "Non-empty file" root &amp;lt; /dev/null&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 24 Apr 2007 19:51:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042320#M95818</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-04-24T19:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Checking a file for content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042321#M95819</link>
      <description>&amp;gt;JRF: [ -s "${FILE}" ] &amp;amp;&amp;amp; mailx -s "Non-empty file" root &amp;lt; /dev/null&lt;BR /&gt;&lt;BR /&gt;A slight fix to send the file when non-empty:&lt;BR /&gt;[ -s "${FILE}" ] &amp;amp;&amp;amp; mailx -s "Non-empty file" root &amp;lt; ${FILE}</description>
      <pubDate>Tue, 24 Apr 2007 20:06:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042321#M95819</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-04-24T20:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Checking a file for content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042322#M95820</link>
      <description>Is there a way to check to see if the file is populated WITHOUT having the mail piece?  I am adding a header to the mail prior to sending it.  So basically, I'm needing to do this...&lt;BR /&gt;&lt;BR /&gt;Populate file A&lt;BR /&gt;Check file A for content&lt;BR /&gt;If no content exists, exit&lt;BR /&gt;If content exists, add header and rmail (doing a EOM, 'cat'ing file A, and piping that to rmail)&lt;BR /&gt;&lt;BR /&gt;Thank you all again for the help.</description>
      <pubDate>Tue, 24 Apr 2007 22:01:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042322#M95820</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2007-04-24T22:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Checking a file for content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042323#M95821</link>
      <description>if [[ -s ${FILE} ]] ; then &lt;BR /&gt;  do your mail stuff&lt;BR /&gt;else&lt;BR /&gt;  exit 999&lt;BR /&gt;fi</description>
      <pubDate>Tue, 24 Apr 2007 22:09:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042323#M95821</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-04-24T22:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Checking a file for content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042324#M95822</link>
      <description>I'm sorry if I seem a bit dense, but what is ${FILE}?  Thanks.</description>
      <pubDate>Tue, 24 Apr 2007 22:19:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042324#M95822</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2007-04-24T22:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Checking a file for content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042325#M95823</link>
      <description>Thanks everyone</description>
      <pubDate>Tue, 24 Apr 2007 22:28:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042325#M95823</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2007-04-24T22:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Checking a file for content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042326#M95824</link>
      <description>&lt;!--!*#--&gt;${FILE} is the filename you want to check.&lt;BR /&gt;&lt;BR /&gt;See if this makes more sense:&lt;BR /&gt;&lt;BR /&gt;FILE=/dir/file&lt;BR /&gt;if [[ -s ${FILE} ]] ; then&lt;BR /&gt;  do email stuff&lt;BR /&gt;else&lt;BR /&gt;  exit 999&lt;BR /&gt;fi</description>
      <pubDate>Tue, 24 Apr 2007 22:37:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-a-file-for-content/m-p/5042326#M95824</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-04-24T22:37:30Z</dc:date>
    </item>
  </channel>
</rss>

