D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Just a silly command line question

 

On Thu, 2007-05-24 at 12:37 +0100, David Johnson wrote:
> On Thursday 24 May 2007 11:27, Martijn wrote:
> > Hello.
> >
> > If I run the command
> >   date +'%Y%m%d.log'
> > it returns
> > 20070524.log
> > (well, it does today). Now I would like to extend the command to use
> > the output as a file name and do something to that file (e.g. cat,
> > less, etc.). Is that possible to do in one line?
> >
> 
> Simply put backticks around the command, e.g.
> 
> cat `date +'%Y%m%d.log'`
> 
Do a touch first:

   touch `date +'%Y%m%d.log'`

then the cat/less/whatever.


John.

-- 
---------------------------------------------------------------
John Horne, University of Plymouth, UK  Tel: +44 (0)1752 233914
E-mail: John.Horne@xxxxxxxxxxxxxx       Fax: +44 (0)1752 233839

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html