storing todays date into a shell variable

Mike Wooding timmywooding at yahoo.com
Fri Dec 17 22:31:33 UTC 2004


--- Rino Mardo <joroxx at gmail.com> wrote:

> you need to use the double-quotes instead of single-quotes. ;-)

 No, he need the back-quote:
       TODAY=`date +%m/%d/%y`
 or the laternate form:
       TODAY=$(date +%m/%d/%y)

> On Thu, 16 Dec 2004 12:41:11 +0530, Mulley, Nikhil
> <mnikhil at corp.untd.com> wrote:
> > Yeah Bill, I do not want to reuse the TODAY variable external to
> the shell script, But what I want to say is When I echo $TODAY 
> variable , it is not displaying the Data.
> > myprompt$./storedate
> > ./storedate: +%m/%d/%y: not found
> > myprompt$
> > 
> > ~Nikhil.
> > 
> > -----Original Message-----
> > From: $Bill Luebkert [mailto:dbecoll at adelphia.net]
> > Sent: Thursday, December 16, 2004 12:37 PM
> > To: Mulley, Nikhil
> > Cc: redhat-list at redhat.com
> > Subject: Re: storing todays date into a shell variable
> > 
> > 
> > Mulley, Nikhil wrote:
> > 
> > > Hi ,
> > > I wanna have a shell script which puts the today's date into a
> shell
> > > variable and later use the Shell Variable for other reasons,
> > > I have been using like this..
> > >
> > > #!/bin/sh
> > > TODAY=date '+%m/%d/%y'
> > > echo $TODAY
> > > Can any one tell me what could be wrong in this...
> > 
> > Changing the date in your env will only change it for you and any
> child
> > processes you create.  Once your shell script exits, the TODAY will
> > disappear for any new scripts run.
> > 
> > --
> >   ,-/-  __      _  _         $Bill Luebkert   
> Mailto:dbecoll at adelphia.net
> >  (_/   /  )    // //       DBE Collectibles    Mailto:dbe at todbe.com
> >   / ) /--<  o // //      Castle of Medieval Myth & Magic
> http://www.todbe.com/
> > -/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers
> stuff)
> > 
> > --
> > redhat-list mailing list
> > unsubscribe
> mailto:redhat-list-request at redhat.com?subject=unsubscribe
> > https://www.redhat.com/mailman/listinfo/redhat-list
> > 
> 
> 
> -- 
> "Every morning, I get up and look through the 'Forbes' list of the
> richest people in America.  If I'm not there, I go to work"
> 	-- Robert Orben
> 
> fingerprint: F615 80CF 76A4 9B73 23CF  7BBC 473B D1B1 751B 8297
> 
> -- 
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
> 


=====
He who laughs last thinks slowest.


	
		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail




More information about the redhat-list mailing list