<?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 - even or odd weeks in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114860#M149529</link>
    <description>Maybe it's better use&lt;BR /&gt;&lt;BR /&gt;date +%w&lt;BR /&gt;&lt;BR /&gt;the output is weekday as a one-digit decimal number [0-6 (Sunday-Saturday)].&lt;BR /&gt;&lt;BR /&gt;HTH</description>
    <pubDate>Mon, 10 Nov 2003 08:56:43 GMT</pubDate>
    <dc:creator>Piergiacomo Perini</dc:creator>
    <dc:date>2003-11-10T08:56:43Z</dc:date>
    <item>
      <title>Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114856#M149525</link>
      <description>Hi , I'd need a function in a normal shell who covers the even or odd issue.&lt;BR /&gt;so simple like this:&lt;BR /&gt;&lt;BR /&gt;if today = an even week do this&lt;BR /&gt;else&lt;BR /&gt;do that&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;thanks in advance&lt;BR /&gt;Andi</description>
      <pubDate>Mon, 10 Nov 2003 08:41:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114856#M149525</guid>
      <dc:creator>Andi Rigauer</dc:creator>
      <dc:date>2003-11-10T08:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114857#M149526</link>
      <description>What about&lt;BR /&gt;date +%U&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Bernhard</description>
      <pubDate>Mon, 10 Nov 2003 08:49:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114857#M149526</guid>
      <dc:creator>Bernhard Mueller</dc:creator>
      <dc:date>2003-11-10T08:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114858#M149527</link>
      <description>You can use "date +%V"&lt;BR /&gt;test it if you can divide by 2 &lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;JL</description>
      <pubDate>Mon, 10 Nov 2003 08:50:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114858#M149527</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2003-11-10T08:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114859#M149528</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;typeset -i week check&lt;BR /&gt;week=`date +'%V'`&lt;BR /&gt;check=$week/2*2&lt;BR /&gt;if [ "$week" = "$check" ]&lt;BR /&gt;then&lt;BR /&gt;  echo "even"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;You can also use %U&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 10 Nov 2003 08:55:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114859#M149528</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2003-11-10T08:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114860#M149529</link>
      <description>Maybe it's better use&lt;BR /&gt;&lt;BR /&gt;date +%w&lt;BR /&gt;&lt;BR /&gt;the output is weekday as a one-digit decimal number [0-6 (Sunday-Saturday)].&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Mon, 10 Nov 2003 08:56:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114860#M149529</guid>
      <dc:creator>Piergiacomo Perini</dc:creator>
      <dc:date>2003-11-10T08:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114861#M149530</link>
      <description>i beg your pardon....&lt;BR /&gt;i confuse&lt;BR /&gt;week with weekday!!!!!&lt;BR /&gt;&lt;BR /&gt;sorry</description>
      <pubDate>Mon, 10 Nov 2003 08:59:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114861#M149530</guid>
      <dc:creator>Piergiacomo Perini</dc:creator>
      <dc:date>2003-11-10T08:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114862#M149531</link>
      <description>Andi,&lt;BR /&gt;&lt;BR /&gt;Jan-Luc and Christian are correct, to comply with DIN standards it should be %V (week 1 of the year is the first week containing a thursday, otherwise it still belongs to last year).&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Bernhard</description>
      <pubDate>Mon, 10 Nov 2003 09:01:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114862#M149531</guid>
      <dc:creator>Bernhard Mueller</dc:creator>
      <dc:date>2003-11-10T09:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114863#M149532</link>
      <description>Depends on what you mean by odd or even.&lt;BR /&gt;&lt;BR /&gt;date +%U and date +%V both return a week number, the first assumes the week starts on a Sunday, the second assumes Monday.&lt;BR /&gt;&lt;BR /&gt;Pick the one which suits you and then do a simple modulo operation.&lt;BR /&gt;&lt;BR /&gt;eg&lt;BR /&gt;#/bin/sh&lt;BR /&gt;w=$(date +%U)&lt;BR /&gt;(( even=$w % 2 ))&lt;BR /&gt;if [ $even -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;  do this&lt;BR /&gt;else&lt;BR /&gt;  do that&lt;BR /&gt;end if&lt;BR /&gt;&lt;BR /&gt;-- Graham&lt;BR /&gt;</description>
      <pubDate>Mon, 10 Nov 2003 09:04:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114863#M149532</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-11-10T09:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114864#M149533</link>
      <description>sorry typo, for "end if", read "fi"</description>
      <pubDate>Mon, 10 Nov 2003 09:05:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114864#M149533</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-11-10T09:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114865#M149534</link>
      <description>You can use a option that give to Output the number of week in the year, from 0 to 53.&lt;BR /&gt;(the first day of the week is Monday, then all days that preceding the first Sunday of new year, are considered in week number 0)&lt;BR /&gt; &lt;BR /&gt;date +%W&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Bruno&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 10 Nov 2003 09:28:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114865#M149534</guid>
      <dc:creator>Bruno Ganino</dc:creator>
      <dc:date>2003-11-10T09:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script - even or odd weeks</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114866#M149535</link>
      <description>If your real goal is to do something every other week whether or not the beginning week is 0 or 1 thgen the easy method is to use caljd.sh. Without arguments it outputs the truncated Julian Day --- days since 4713BCE.&lt;BR /&gt;&lt;BR /&gt;if [[ $(( (($(caljd.sh) + 1) / 7) % 2) )) -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "Week is even"&lt;BR /&gt;else&lt;BR /&gt;  echo "Week is odd"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;This will work whether there are 52 weeks or&lt;BR /&gt;53 weeks in the year.&lt;BR /&gt;&lt;BR /&gt;We add 1 to the Julian Day (so that weeks start on Sunday), divide by 7 to get the week number and then a mod 2.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 10 Nov 2003 11:03:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-even-or-odd-weeks/m-p/3114866#M149535</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-11-10T11:03:40Z</dc:date>
    </item>
  </channel>
</rss>

