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

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



> On Fri, Oct 13, 2006 at 11:32:03AM -0400, José Alburquerque wrote:
> > However, I do admit that using time for commands is probably a lot 
> > better.  Besides, I can never get a "precise" time with just inserting 
> > the date in the prompt because if the terminal sits idle for some time, 
> > the time in which a command starts executing can not be correctly 
> > determined this way because you never really know how much time went by 
> > (by just looking at the prompt) before the command started execution.
> > 
> > Wouldn't it be nice if bash would allow a "secondary" definable "prompt" 
> > that would be issued just *before* command execution?  Then stuff like 
> > printing date before commands could be done.  Just a wish. :-)  But 
> > thanks for input.

On 13.10.06 08:19, Ken Irving wrote:
> The -t option to script gives precise timing of output to the terminal,
> and could be post-processed to yield the timing you're looking for.

tcsh has the feature of printing time automatically after each command
executed (time variable). it also has 'precmd' and 'postcmd' aliases that
are executed (if set) before and after any command executed.

However tcsh is not bourne shell compatible, you'd have to learn working
with it (well, I prefer tcsh over bash)
-- 
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.
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton



Reply to: