<?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: Need help in Shell scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851230#M274880</link>
    <description>Hi Cem,&lt;BR /&gt;&lt;BR /&gt; Jan)SEARCH_MTH=Dec;((SEARCH_YEAR=YEAR-1));SEARCH_DAY=31;;&lt;BR /&gt;Feb)SEARCH_MTH=Jan;SEARCH_YEAR=${YEAR};SEARCH_DAY=31;;&lt;BR /&gt;&lt;BR /&gt; In the above sample lines of yours, from wheres the ${YEAR} taken from..?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;WH&lt;BR /&gt;</description>
    <pubDate>Mon, 28 Aug 2006 02:13:42 GMT</pubDate>
    <dc:creator>Whitehorse_1</dc:creator>
    <dc:date>2006-08-28T02:13:42Z</dc:date>
    <item>
      <title>Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851225#M274875</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt; I just born new in Shell scripting., I gota to know, If Im giving "cal 7 1950", it should gimme the number of days in that calender.&lt;BR /&gt; Anyways please..&lt;BR /&gt;&lt;BR /&gt;WH..</description>
      <pubDate>Mon, 28 Aug 2006 00:42:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851225#M274875</guid>
      <dc:creator>Whitehorse_1</dc:creator>
      <dc:date>2006-08-28T00:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851226#M274876</link>
      <description>That's correct...you can see July of 1950&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 01:17:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851226#M274876</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2006-08-28T01:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851227#M274877</link>
      <description>and if you give just "cal 1950"&lt;BR /&gt;and you see all month's of day of the year&lt;BR /&gt;1950&lt;BR /&gt;Good Luck,</description>
      <pubDate>Mon, 28 Aug 2006 01:18:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851227#M274877</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2006-08-28T01:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851228#M274878</link>
      <description>Cem, Thxs for reply, I hope I need to clarify my Qn. a bit..&lt;BR /&gt;&lt;BR /&gt; I need a script/command/function(interactive), using which, If I give the "Month and Year" as input, I should just give the output as "The month/Yr which you have typed has got XY days"...I just need the number of days, if I give any month/yr..&lt;BR /&gt;&lt;BR /&gt;WH..</description>
      <pubDate>Mon, 28 Aug 2006 01:27:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851228#M274878</guid>
      <dc:creator>Whitehorse_1</dc:creator>
      <dc:date>2006-08-28T01:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851229#M274879</link>
      <description>i may misunderstood..Do you need to manipulate "date" if so here are some examples;&lt;BR /&gt;baan01:/#date&lt;BR /&gt;Mon Aug 28 10:01:44 EETDST 2006&lt;BR /&gt;&lt;BR /&gt;## Work out what yesterday's date was&lt;BR /&gt;&lt;BR /&gt;  if [ "${DAY}" = "01" ]&lt;BR /&gt;  then&lt;BR /&gt;    case ${MTH} in&lt;BR /&gt;        Jan)SEARCH_MTH=Dec;((SEARCH_YEAR=YEAR-1));SEARCH_DAY=31;&lt;BR /&gt;;&lt;BR /&gt;        Feb)SEARCH_MTH=Jan;SEARCH_YEAR=${YEAR};SEARCH_DAY=31;;&lt;BR /&gt;        Mar)SEARCH_MTH=Feb;SEARCH_YEAR=${YEAR};SEARCH_DAY=28;;&lt;BR /&gt;        Apr)SEARCH_MTH=Mar;SEARCH_YEAR=${YEAR};SEARCH_DAY=31;;&lt;BR /&gt;        May)SEARCH_MTH=Apr;SEARCH_YEAR=${YEAR};SEARCH_DAY=30;;&lt;BR /&gt;        Jun)SEARCH_MTH=May;SEARCH_YEAR=${YEAR};SEARCH_DAY=31;;&lt;BR /&gt;        Jul)SEARCH_MTH=Jun;SEARCH_YEAR=${YEAR};SEARCH_DAY=30;;&lt;BR /&gt;        Aug)SEARCH_MTH=Jul;SEARCH_YEAR=${YEAR};SEARCH_DAY=31;;&lt;BR /&gt;        Sep)SEARCH_MTH=Aug;SEARCH_YEAR=${YEAR};SEARCH_DAY=31;;&lt;BR /&gt;        Oct)SEARCH_MTH=Sep;SEARCH_YEAR=${YEAR};SEARCH_DAY=30;;&lt;BR /&gt;        Nov)SEARCH_MTH=Oct;SEARCH_YEAR=${YEAR};SEARCH_DAY=31;;&lt;BR /&gt;        Dec)SEARCH_MTH=Nov;SEARCH_YEAR=${YEAR};SEARCH_DAY=30;;&lt;BR /&gt;    esac&lt;BR /&gt;  else&lt;BR /&gt;    SEARCH_MTH=${MTH}&lt;BR /&gt;    SEARCH_YEAR=${YEAR}&lt;BR /&gt;    ((SEARCH_DAY=DAY-1))&lt;BR /&gt;    if [ "${SEARCH_DAY}" -lt "10" ]&lt;BR /&gt;    then&lt;BR /&gt;      SEARCH_DAY="0${SEARCH_DAY}"&lt;BR /&gt;    fi&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;  ONE_DAY_BACK="${SEARCH_YEAR}-${SEARCH_MTH}-${SEARCH_DAY}"&lt;BR /&gt;  TODAY="${SEARCH_YEAR}-${SEARCH_MTH}-${DAY}"&lt;BR /&gt;&lt;BR /&gt;OR;&lt;BR /&gt;&lt;BR /&gt; How to schedule a job on last friday;&lt;BR /&gt;## get actual day&lt;BR /&gt;DAY=`date +"%d"`&lt;BR /&gt;&lt;BR /&gt;## get the last friday of curren month&lt;BR /&gt;EXEC_DAY=`cal | awk 'NF &amp;gt;=6 { last = $6 }; END{ print last }'`&lt;BR /&gt;&lt;BR /&gt;if [ $DAY -ne $EXEC_DAY ]&lt;BR /&gt;then&lt;BR /&gt;    echo " - Not run because is not the last friday - "&lt;BR /&gt;    exit;&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;## Here must write your script&lt;BR /&gt;## your commands&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 01:57:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851229#M274879</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2006-08-28T01:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851230#M274880</link>
      <description>Hi Cem,&lt;BR /&gt;&lt;BR /&gt; Jan)SEARCH_MTH=Dec;((SEARCH_YEAR=YEAR-1));SEARCH_DAY=31;;&lt;BR /&gt;Feb)SEARCH_MTH=Jan;SEARCH_YEAR=${YEAR};SEARCH_DAY=31;;&lt;BR /&gt;&lt;BR /&gt; In the above sample lines of yours, from wheres the ${YEAR} taken from..?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;WH&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Aug 2006 02:13:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851230#M274880</guid>
      <dc:creator>Whitehorse_1</dc:creator>
      <dc:date>2006-08-28T02:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851231#M274881</link>
      <description>oppsss....sorry..&lt;BR /&gt;DAY=`date +%d`&lt;BR /&gt;MTH=`date +%m`&lt;BR /&gt;YEAR=`date +%Y`</description>
      <pubDate>Mon, 28 Aug 2006 02:17:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851231#M274881</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2006-08-28T02:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851232#M274882</link>
      <description>&lt;BR /&gt;baan01:/#DAY=`date +%d`&lt;BR /&gt;baan01:/#echo $DAY&lt;BR /&gt;28&lt;BR /&gt;baan01:/#MTH=`date +%m`&lt;BR /&gt;baan01:/#echo $MTH&lt;BR /&gt;08&lt;BR /&gt;baan01:/#YEAR=`date +%Y`&lt;BR /&gt;baan01:/#echo $YEAR&lt;BR /&gt;2006&lt;BR /&gt;baan01:/#</description>
      <pubDate>Mon, 28 Aug 2006 02:20:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851232#M274882</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2006-08-28T02:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851233#M274883</link>
      <description>hi WH,&lt;BR /&gt;&lt;BR /&gt;is this script appropriate ?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# count days of a month&lt;BR /&gt;MYNAME=${0##*/} &lt;BR /&gt;if [ $# != 2 ] ; then&lt;BR /&gt;   echo "usage : $MYNAME month year"&lt;BR /&gt;   exit 1&lt;BR /&gt;fi&lt;BR /&gt;cal $1 $2 | tail +3 | wc -w&lt;BR /&gt;&lt;BR /&gt;Joel</description>
      <pubDate>Tue, 29 Aug 2006 02:47:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851233#M274883</guid>
      <dc:creator>Joel Girot</dc:creator>
      <dc:date>2006-08-29T02:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851234#M274884</link>
      <description>Hi,&lt;BR /&gt;you can use:&lt;BR /&gt;&lt;BR /&gt;#/user/bin/ksh&lt;BR /&gt;# day_of_month&lt;BR /&gt;MM=${1:-$(date +%m)}&lt;BR /&gt;YYYY=${2:-$(date +%Y)}&lt;BR /&gt;TEMP=$(cal $MM $YYYY)&lt;BR /&gt;DAYS=$(echo $TEMP|awk '{print $NF}')&lt;BR /&gt;echo "$MM $YYYY has $DAYS"&lt;BR /&gt;#eof&lt;BR /&gt;&lt;BR /&gt;day_of_month&lt;BR /&gt;08 2006 has 31&lt;BR /&gt;&lt;BR /&gt;day_of_month 7 1950&lt;BR /&gt;7 1950 has 31&lt;BR /&gt;&lt;BR /&gt;it runs fine on hp hp-ux 11i. (It take care leap years of course).&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Tue, 29 Aug 2006 03:08:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851234#M274884</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-08-29T03:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851235#M274885</link>
      <description>hi,&lt;BR /&gt;I'msorry i wrong type the first line of teh script: user instead of usr.&lt;BR /&gt;I improved a script a bit as well removing teh TEMP variable.&lt;BR /&gt;&lt;BR /&gt;#/usr/bin/ksh&lt;BR /&gt;MM=${1:-$(date +%m)}&lt;BR /&gt;YYYY=${2:-$(date +%Y)}&lt;BR /&gt;DAYS=$(cal $MM $YYYY|awk 'END {print $NF}')&lt;BR /&gt;echo "$MM $YYYY has $DAYS"&lt;BR /&gt;#eof&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Tue, 29 Aug 2006 03:12:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851235#M274885</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-08-29T03:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need help in Shell scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851236#M274886</link>
      <description>Hi Joel,&lt;BR /&gt;&lt;BR /&gt; Thanks, exactly what I was looking for...&lt;BR /&gt;&lt;BR /&gt;Thx, Cem and Arturo...&lt;BR /&gt;&lt;BR /&gt;Assigned points too.. :-), WH</description>
      <pubDate>Fri, 01 Sep 2006 00:54:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-in-shell-scripting/m-p/3851236#M274886</guid>
      <dc:creator>Whitehorse_1</dc:creator>
      <dc:date>2006-09-01T00:54:53Z</dc:date>
    </item>
  </channel>
</rss>

