storing current month in shell variable..
Ed Wilts
ewilts at ewilts.org
Thu Dec 16 12:36:41 UTC 2004
On Thu, Dec 16, 2004 at 01:03:48PM +0530, Mulley, Nikhil wrote:
> Hi ,
> Nikhil again ... :)
> I wanna store the current month in a shell variable , for which I am attempting to do like this ...
> #!/usr/bin/sh
> MON=`(date | awk '{print $2}')
> echo $MON
> But when I execute the script , I get nothing...
For starters, you're calling awk when you don't need to - you can get
the month text with the proper arguments to date. You are also missing
the trailing `. Try this:
[ewilts at pe400 ~]$ MON=`date +%b`
[ewilts at pe400 ~]$ echo $MON
Dec
--
Ed Wilts, RHCE
Mounds View, MN, USA
mailto:ewilts at ewilts.org
Member #1, Red Hat Community Ambassador Program
More information about the redhat-list
mailing list