<?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: Script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691775#M55535</link>
    <description>Try looking at "man test"!&lt;BR /&gt;&lt;BR /&gt;This gives you all of the possible switches you can give to an "if" statement.&lt;BR /&gt;I.E.&lt;BR /&gt;if [ -n FILE ] ; then&lt;BR /&gt;echo "the file exists and is not zero size".&lt;BR /&gt;elif [ -z FILE ] ; then&lt;BR /&gt;echo "the file exists and is zero size"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Note that to properly do this, you should embed this in a check for the file first!  I.E.&lt;BR /&gt;if [ -f FILE ] ; then&lt;BR /&gt;  if [ -n FILE ] ; then&lt;BR /&gt;    echo "file is there, and has size &amp;lt;0"&lt;BR /&gt;  else&lt;BR /&gt;    echo "file is there, but has 0 size"&lt;BR /&gt;  fi&lt;BR /&gt;else&lt;BR /&gt;  echo "the file is not there".&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Again, man pages are your friends, but it can be hard to know where to look!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
    <pubDate>Wed, 27 Mar 2002 15:08:45 GMT</pubDate>
    <dc:creator>Shannon Petry</dc:creator>
    <dc:date>2002-03-27T15:08:45Z</dc:date>
    <item>
      <title>Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691770#M55530</link>
      <description>Hi, I need to write a script which will look for a file in dir and if the file is there and the size is not zero then it will email to the group, Can someone help how to do it... Thanks in advance</description>
      <pubDate>Wed, 27 Mar 2002 13:31:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691770#M55530</guid>
      <dc:creator>Anthony khan</dc:creator>
      <dc:date>2002-03-27T13:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691771#M55531</link>
      <description>The test you want is this:&lt;BR /&gt;&lt;BR /&gt;if [ -s filename ]&lt;BR /&gt;then&lt;BR /&gt;   cat filename | mail username&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I just tested it with an empty file, then a non-zero file.  Only the non-zero file was emailed.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Mar 2002 13:38:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691771#M55531</guid>
      <dc:creator>Steve Lewis</dc:creator>
      <dc:date>2002-03-27T13:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691772#M55532</link>
      <description>First test this:&lt;BR /&gt;&lt;BR /&gt;# cd /tmp&lt;BR /&gt;# touch AAA1&lt;BR /&gt;# touch AAA2&lt;BR /&gt;# echo hello&amp;gt;AAA2&lt;BR /&gt;# ls -l AAA*&lt;BR /&gt;-rw-rw-rw-   1 root       sys              0 Mar 27 08:28 AAA1&lt;BR /&gt;-rw-rw-rw-   1 root       sys              6 Mar 27 08:29 AAA2&lt;BR /&gt;# find /tmp -type f -name "AAA*" -size +0c&lt;BR /&gt;/tmp/AAA2&lt;BR /&gt;# find /tmp -type f -name "AAA*" -size +0c -exec ls -l {} \; | mail SOMEUSE@SOMEWHERE.com                            &lt;BR /&gt;&lt;BR /&gt;THEN, create a simple script with this in it:&lt;BR /&gt;&lt;BR /&gt;find /tmp -type f -name "AAA*" -size +0c -exec ls -l {} \; | mail SOMEUSE@SOMEWHERE.com                            &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Mar 2002 13:41:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691772#M55532</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-03-27T13:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691773#M55533</link>
      <description>Hy!&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;cd /net/bin &amp;gt; /dev/null&lt;BR /&gt;l -1 &amp;gt;! fic&lt;BR /&gt;foreach file ('cat fic')&lt;BR /&gt;if ( (! -z ${file} &amp;amp;&amp;amp; (-e ${file}) ) then&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;endif&lt;BR /&gt;end&lt;BR /&gt;&lt;BR /&gt;FRANK.</description>
      <pubDate>Wed, 27 Mar 2002 13:44:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691773#M55533</guid>
      <dc:creator>Francois Bariselle_3</dc:creator>
      <dc:date>2002-03-27T13:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691774#M55534</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you could such like this:&lt;BR /&gt;&lt;BR /&gt;DIR=/directory&lt;BR /&gt;FILE=file&lt;BR /&gt;&lt;BR /&gt;while :&lt;BR /&gt;do&lt;BR /&gt;if [ -s $DIR/$FILE ]&lt;BR /&gt;then&lt;BR /&gt;  cat $DIR/$FILE | mailx user@domain&lt;BR /&gt;  mv $DIR/$FILE $DIR/$FILE.old&lt;BR /&gt;fi&lt;BR /&gt;sleep 10&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This will look every 10 seconds for file and if it has size &amp;gt; 0 it will be mailed and then  renamed.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 27 Mar 2002 13:58:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691774#M55534</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2002-03-27T13:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691775#M55535</link>
      <description>Try looking at "man test"!&lt;BR /&gt;&lt;BR /&gt;This gives you all of the possible switches you can give to an "if" statement.&lt;BR /&gt;I.E.&lt;BR /&gt;if [ -n FILE ] ; then&lt;BR /&gt;echo "the file exists and is not zero size".&lt;BR /&gt;elif [ -z FILE ] ; then&lt;BR /&gt;echo "the file exists and is zero size"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Note that to properly do this, you should embed this in a check for the file first!  I.E.&lt;BR /&gt;if [ -f FILE ] ; then&lt;BR /&gt;  if [ -n FILE ] ; then&lt;BR /&gt;    echo "file is there, and has size &amp;lt;0"&lt;BR /&gt;  else&lt;BR /&gt;    echo "file is there, but has 0 size"&lt;BR /&gt;  fi&lt;BR /&gt;else&lt;BR /&gt;  echo "the file is not there".&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Again, man pages are your friends, but it can be hard to know where to look!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
      <pubDate>Wed, 27 Mar 2002 15:08:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691775#M55535</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2002-03-27T15:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691776#M55536</link>
      <description>Thanks everyone for your suggestions one more thing, is there any way I can limit my search in /playpan/data, because there are some subdir in /playpen/data which i don't wanna include in search.</description>
      <pubDate>Wed, 27 Mar 2002 15:17:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691776#M55536</guid>
      <dc:creator>Anthony khan</dc:creator>
      <dc:date>2002-03-27T15:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691777#M55537</link>
      <description>If you thank all replies by words, why not assigning points ????</description>
      <pubDate>Wed, 27 Mar 2002 16:27:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691777#M55537</guid>
      <dc:creator>Ceesjan van Hattum</dc:creator>
      <dc:date>2002-03-27T16:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691778#M55538</link>
      <description>HI Ceesjan, thanks for reminding me I am still working on script, once its done i will assign points to every one including you.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 27 Mar 2002 16:34:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691778#M55538</guid>
      <dc:creator>Anthony khan</dc:creator>
      <dc:date>2002-03-27T16:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691779#M55539</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;find /playpen/data -type f -name "AAA*" -size +0c -exec ls -l {} \; | grep -v -e "\/somedirA/\" -e "\/somedirB\/" -e "\/somedirC\/" | mail SOMEUSE@SOMEWHERE.com&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Wed, 27 Mar 2002 16:43:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691779#M55539</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-03-27T16:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691780#M55540</link>
      <description>#!/usr/bin/ksh&lt;BR /&gt;#&lt;BR /&gt;DIR2SRCH="/playpen/data"&lt;BR /&gt;FILE2FIND="AAA*"&lt;BR /&gt;EXCLUDETHESEDIRS='-e \/uuuu\/ -e \/yyyy\/ -e \/zzzz\/'&lt;BR /&gt;#&lt;BR /&gt;find ${DIR2SRCH} -type f -name "${FILE2FIND}" -size +0c -exec ls -l {} \; | grep&lt;BR /&gt; -v ${EXCLUDETHESEDIRS} | mail SOMEUSE@SOMEWHERE.com&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;in a script&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Wed, 27 Mar 2002 17:00:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2691780#M55540</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-03-27T17:00:27Z</dc:date>
    </item>
  </channel>
</rss>

