<?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 shell script with date logic in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-with-date-logic/m-p/2815078#M85343</link>
    <description>I have a script named 'xx.shl' as follows&lt;BR /&gt;$cat xx.shl&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;x1.shl&lt;BR /&gt;x2.shl&lt;BR /&gt;&lt;BR /&gt;now I have to run xx.shl&lt;BR /&gt;daily. but I want to skip(not to execute) the x2.shl , if the date &lt;BR /&gt;is 25,26, 27 ...upto one day before of the last day.&lt;BR /&gt;&lt;BR /&gt;for example&lt;BR /&gt;if the last date is 31, then &lt;BR /&gt;i don't want to execute the x2.shl &lt;BR /&gt;between 25,26,27,28,29,30.&lt;BR /&gt;&lt;BR /&gt;if the last date is 28, then&lt;BR /&gt;i don't want to execute the x2.shl &lt;BR /&gt;between 25,26,27.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thanks in advance.&lt;BR /&gt;Vasu</description>
    <pubDate>Fri, 27 Sep 2002 14:09:26 GMT</pubDate>
    <dc:creator>vas  bolpali</dc:creator>
    <dc:date>2002-09-27T14:09:26Z</dc:date>
    <item>
      <title>shell script with date logic</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-with-date-logic/m-p/2815078#M85343</link>
      <description>I have a script named 'xx.shl' as follows&lt;BR /&gt;$cat xx.shl&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;x1.shl&lt;BR /&gt;x2.shl&lt;BR /&gt;&lt;BR /&gt;now I have to run xx.shl&lt;BR /&gt;daily. but I want to skip(not to execute) the x2.shl , if the date &lt;BR /&gt;is 25,26, 27 ...upto one day before of the last day.&lt;BR /&gt;&lt;BR /&gt;for example&lt;BR /&gt;if the last date is 31, then &lt;BR /&gt;i don't want to execute the x2.shl &lt;BR /&gt;between 25,26,27,28,29,30.&lt;BR /&gt;&lt;BR /&gt;if the last date is 28, then&lt;BR /&gt;i don't want to execute the x2.shl &lt;BR /&gt;between 25,26,27.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thanks in advance.&lt;BR /&gt;Vasu</description>
      <pubDate>Fri, 27 Sep 2002 14:09:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-with-date-logic/m-p/2815078#M85343</guid>
      <dc:creator>vas  bolpali</dc:creator>
      <dc:date>2002-09-27T14:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: shell script with date logic</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-with-date-logic/m-p/2815079#M85344</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;In your script :-&lt;BR /&gt;&lt;BR /&gt;last=`cal | sed '/^$/d' | tail -1 | head -1 | awk '{print $NF}'`&lt;BR /&gt;&lt;BR /&gt;echo $last&lt;BR /&gt;&lt;BR /&gt;this will gice the last day of the month.&lt;BR /&gt;&lt;BR /&gt;So you can use an if statement &lt;BR /&gt;&lt;BR /&gt;if [[ $last != 31]]&lt;BR /&gt;&lt;BR /&gt;then&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Fri, 27 Sep 2002 14:29:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-with-date-logic/m-p/2815079#M85344</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-09-27T14:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: shell script with date logic</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-with-date-logic/m-p/2815080#M85345</link>
      <description>Hi Vasu"&lt;BR /&gt;&lt;BR /&gt;You can leverage the 'cal' utility here:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;TODAY=`date "+%d"`&lt;BR /&gt;LASTD=`cal|awk 'NF &amp;gt; 0 {LASTD=$NF};END{ print LASTD}'`&lt;BR /&gt;let LASTD=LASTD-1&lt;BR /&gt;if [ "$TODAY" -ge 25 -a "$TODAY" -le "$LASTD" ]&lt;BR /&gt;then&lt;BR /&gt;  echo "skip"&lt;BR /&gt;else&lt;BR /&gt;  echo "run!"&lt;BR /&gt;fi&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 27 Sep 2002 14:42:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-with-date-logic/m-p/2815080#M85345</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-27T14:42:28Z</dc:date>
    </item>
  </channel>
</rss>

