I'm trying to get the first day of the next quartal, for example now I'd like to get 00:01 2012-01-01. It shouldn't be too difficult. But I'm stuck with a syntax error because I can't manage to escape everything correctly.
To get the correct month I want to use:
expr `date "+( ( %m - 1 ) / 3 + 1 ) * 3 % 12 + 1"`
The part ( %m - 1 ) / 3 + 1 calculates the number of the current quartal.
However, the * seems to be wrong there somehow. If I replace it by + there is no syntax error (the result is just not interesting for me...). I tried to escape the * by using \* but this doesn't help. I suppose there is some problem with the backticks.
How can I escape the * correctly?
Edit: My problem is already solved, but I want to add a short warning for others. Note that you would need to add also leading zeros for the month, if you want to use it directly in a date and to care also about the correct year. So at the end of the day, paxdiablo's suggestion is probably the easiest.