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

Re: Printing the date just before execution of commands in bash



On 12.10.06 19:10, José Alburquerque wrote:
> Hi all.  I'm wondering if anyone knows how I might be able to execute
> the same command just before the execution of a command issued at the
> prompt of a bash shell.

you could try to insert the current date into your prompt (PS1) string, if
you want it this way.

also, looking at 'man bash', there's special variable:

PROMPT_COMMAND
    If set, the value is executed as a command prior to issuing each
    primary prompt.

> If I can print the date just before each command is executed, I
> can always be able to get a sense of how long each command has taken.

if not each command, using 'time command' rells you much more and also tells
you exactly how much did command take to complete, while seeing two times
you have to substract it (not so easy sometimes, 10:23 vs 09:47), if you
haven't lost it from your screen already...

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Depression is merely anger without enthusiasm. 



Reply to: