Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>hope that's what you mean. Below can be changed to vary the output formats of the dates.</p> <p>date command can be used for that, dunno if ncal is any more/less efficient.</p> <p>I know you went for "binning" now, but here is a more readable v.</p> <pre><code>$ cat /tmp/1.sh #!/bin/bash test -z "$year" &amp;&amp; { echo "I expect you to set \$year environment variable" echo "In return I will display you the Mondays of this year" exit 1 } # change me if you would like the date format to be different # man date would tell you all the combinations you can use here DATE_FORMAT="+%Y-%m-%d" # change me if you change the date format above. I need to be # able to extract the year from the date I'm shoing you GET_YEAR="s/-.*//" # this value is a week, in milliseconds. Changing it would change # what I'm doing. WEEK_INC=604800 # Use another 3-digit week day name here, to see dates for other week days DAY_OF_WEEK=Mon # stage 1, let's find us the first day of the week in this year d=1 # is it DAY_OF_WEEK yet? while test "$(date -d ${year}-1-${d} +%a)" != "$DAY_OF_WEEK"; do # no, so let's look at the next day d=$((d+1)); done; # let's ask for the milliseconds for that DAY_OF_WEEK that I found above umon=$(date -d ${year}-1-${d} +%s) # let's loop until we break from inside while true; do # ndate is the date that we testing right now ndate=$(date -d @$umon "$DATE_FORMAT"); # let's extract year ny=$(echo $ndate|sed "$GET_YEAR"); # did we go over this year? If yes, then break out test $ny -ne $year &amp;&amp; { break; } # move on to next week umon=$((umon+WEEK_INC)) # display the date so far echo "$ndate" done </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload