Register
It is currently Fri Oct 31, 2014 1:18 pm

Shell scripting on a Mac (CAL & DATE)


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Mon May 10, 2010 1:44 pm   

Joined: Mon May 10, 2010 12:13 pm
Posts: 2
Hi,

I am trying to create a calendar (on the fly) that will display next month.

I'm not talking about June 2010 (although since this is may that is next month). I want to have a script that will display a calendar for next month no matter when it is run.

If it is run in February, it will create a calendar for March.
If it is run in June, it will create a calendar for July.
If it is run in December, it will create a calendar for January.

I have tried:
Code:
cal -m $(date +"%m %Y" -d "today + 1 month")


As this works on Linux, Unfortunately on my Mac the 'date' command doesn't like the format.

Does anyone have any ideas?


Top
 Profile  
 PostPosted: Mon May 10, 2010 2:05 pm   

Joined: Mon May 10, 2010 12:13 pm
Posts: 2
Nevermind,

I got the answer:

Code:
cal -m`date -v-1m +"%m"`


for anyone interested


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP