LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   help with calendar with only week number (https://www.linuxquestions.org/questions/programming-9/help-with-calendar-with-only-week-number-942058/)

ANU 04-27-2012 05:30 AM

help with calendar with only week number
 
hello all,
im stuck, i couldnt find anywhere what i need
i tried to modify existing calendar scripts to show what i need, but no luck

please give me a push, a helping hand ;)

this i how i imagine the calender will look like, i input the month and the year and it will generate a page like this:
http://img805.imageshack.us/img805/8458/calweeks.jpg

thanks for any help

tronayne 04-27-2012 08:24 AM

Here's a hint: the date utility will return the current (today) week number thus:
Code:

date +%W
17

And,
Code:

date -d"04/15/2012" +%W
15

Another hint, there are 52 weeks in a year, in a loop set a variable starting at 1, stopping at 52; use that variable to print your strings.

Here's a simple example:
Code:

WEEK=1
while (( ${WEEK} <= 52 ))
do
        echo -n "${WEEK} link_report?weeknr=${WEEK}&auto=vw "
        echo -n "link_raport?weeknr=${WEEDK}&auto=audi "
        echo -n "link_raport?weeknr=${WEEK}&auto=nissan "
        echo "link_raport?weeknr=${WEEK}&auto=skoda"
        (( WEEK=WEEK+1 ))
done

Hope this helps some.


All times are GMT -5. The time now is 12:07 AM.