Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: UNIX script

Re: UNIX script

From: stephen booth <stephenbooth.uk_at_gmail.com>
Date: Tue, 29 Mar 2005 13:55:12 +0100
Message-ID: <687bf9c4050329045572e6ca68@mail.gmail.com>


On Tue, 29 Mar 2005 15:45:21 +0300, The Human Fly <sjaffarhussain_at_gmail.com> wrote:
> Hello list,
>
> Sorry, its slightly off-topic, UNIX related.
>
> My requirement is whenever I divert my output to a file, that should
> contains filename along with the data and time.
>
> For example,
>
> ls -ltr > xyz
>
> and next time when I do the same, it should ot overwite to the file,
> instead create the file with date and time along with it.

You need to use the date command:

# ls -ltr > xyz.`date [options]`

Note that ` is the backtick which causes the shell to execute what they contain as a command and pipe the output back.

I can't remember the options off the top of my head. Check the man page for the date command. As I recall 'xyz.`date +%Y%m%d`' should, today, give you 'xyz.20050329' but test it first.

Stephen

-- 
It's better to ask a silly question than to make a silly assumption.
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Mar 29 2005 - 07:58:54 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US