View Single Post
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#942
Originally Posted by Schturman View Post
Noticed that billboard stoped to show my month script:
Code:
#!/bin/sh

month=$(date +%m)
echo | awk -v d=$((month)) '{split("בינואר,בפברואר,במרץ,באפריל,במאי,ביוני,ביולי,באוגוסט,בספטמבר,באוקטובר,בנובמבר,בדצמבר",a,","); printf a[d]}'
I run it like this:
Code:
{script:sh /home/user/my_month.sh}
Don't know what a reason that it stoped to work....
Any help ?
Thanks
There is an arithmetic syntax error in the index of the month. $month at the moment returns the string "08" and $((month)) returns the error. I really have no idea why this is so and can't be arsed to find out.

In python, it would be something like this:

Code:
#!/usr/bin/python
from datetime import datetime

months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
month = months[datetime.now().month-1]
print month