Trying to figure out a date command
Newbieness glaring brightly here :o Working through a Unix/Linux book trying to figure out the basics of the shell. I am trying to figure out how to run a command with bash to find the last day of the month in any given month. I read the man pages for date and cal but I am stupid or missing something. I figured out many things but this is the only one that has me pulling my hair out at this time. Thanks in advance.
|
Quote:
|
Well what is it your trying to get? This is a example using the date command with a backup
tar cvzpf homebackup-`date +%m-%d-%y` /home/username If you noticed I put the date command in ``. So give a little more info if this doesn't cover what you need |
Hi,
this, e.g., will also give you the name of the day: Code:
cal feb 2000|sort -nr | awk 'FNR==1{a=NF;b=$NF}/^[^ [:digit:]]/{print $a,b}' |
Thank you, now I have to digest this. Thanks for the help. Much appreciated.:)
for the last day of October Code:
echo $(cal 10 2011) | awk '{print $NF}' Code:
cal 10 2011|sort -nr | awk 'FNR==1{a=NF;b=$NF}/^[^ [:digit:]]/{print $a,b}' |
oops sorry OP i just realized I had misread your question.
|
All times are GMT -5. The time now is 07:35 PM. |