Hei.
I want to calculate with the output of
As it is the 8th week of the year the output is currently "08" but I need it to be just "8".
How can I cut off the "0"?
Made the .sh script last year and it works with the week of year beeing at least 10.
The script doesn't do any more then finding if the week is even or odd and it look like this:
Now the script gives the following error:
Changing the script in any way would also do, but I don't know how.
Help appreciated![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I want to calculate with the output of
date "+%W"
, which is the week of the year.As it is the 8th week of the year the output is currently "08" but I need it to be just "8".
How can I cut off the "0"?
Made the .sh script last year and it works with the week of year beeing at least 10.
The script doesn't do any more then finding if the week is even or odd and it look like this:
Code:
if [ $((`date "+%W"`%2)) -eq 0 ];then echo even > /var/cron/week_of_year
else echo odd > /var/cron/week_of_year
fi
Now the script gives the following error:
Code:
./week_of_year.sh: arithmetic expression: expecting EOF: "08%2"
Changing the script in any way would also do, but I don't know how.
Help appreciated