Re: storing current month in shell variable..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@pe400 ~]$ MON=`date +%b`
[ewilts@pe400 ~]$ echo $MON
Dec

-- 
Ed Wilts, RHCE
Mounds View, MN, USA
mailto:ewilts@xxxxxxxxxx
Member #1, Red Hat Community Ambassador Program

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux