Get the last day of the last month in csh?

Posted by ANE on Stack Overflow See other posts from Stack Overflow or by ANE
Published on 2010-03-24T21:15:13Z Indexed on 2010/03/24 22:03 UTC
Read the original article Hit count: 387

Filed under:
|
|
|

How do you get the last day of the last month in csh?

Here is the code so far. The cal command below works if you execute it from the (FreeBSD sh) command line, but I'm having trouble escaping it properly to run within a script.

#!/bin/csh
set lastdayoflastmonth=`cal `date '+%m'` `date '+%Y'` | grep . | fmt -1 | tail -1`
echo $lastdayoflastmonth

© Stack Overflow or respective owner

Related posts about csh

Related posts about date