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

 

Hi Martijn,

On Thu, May 24, 2007 at 11:27:35AM +0100, Martijn wrote:
> 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?

$(date +'%Y%m%d.log') is equivalent to `date +'%Y%m%d.log'` by the
way, but is more readable and far easier to nest.  It is however
bash-specific I believe.

Cheers,
Andy

-- 
http://bitfolk.com/ -- No-nonsense VPS hosting
Encrypted mail welcome - keyid 0x604DE5DB

Attachment: signature.asc
Description: Digital signature

-- 
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