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

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



Matus UHLAR - fantomas wrote:

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)

I used to use tcsh a few years ago (I believe middle to late 90's) when studying at my local city college and found it quite useful. I remember defining aliases, and having to remember the difference between 'export VAR=VALUE' and 'setenv VAR VALUE' in different shell environments. When bash was released and began to be used in linux I thought it was better (in some ways I think it is) so I made the switch (on my home system). Lately I'm spending a lot more time at the shell prompt so I've noticed the need for minor things like getting the time for commands, etc. I guess I'm growing in shell experience? :-)

Anyway, it looks like tcsh has a lot more than bash in this area. I may just give tcsh another try. On the other hand, it's not that inconvenient to not be able to get this automatically in bash. I would just have to remember to use the 'time' command when I really want to time something. :-)

Honestly, though, I'll most probably end up sticking with bash just because I'm so used to it by now. I really like all the suggestions, I just thought that someone might know something that I did not and was not able to figure out. It seems that this is just something that bash does not support and I sort of understand why. (Like someone already said, what if the prompt scrolls out of visibility? The usefulness of printing something just before command execution is hindered.)

In all honestly, this is not something absolutely indispensable for me just something I thought that if it were possible was something that I sort of wanted to do. However, it wont make my work harder if I don't have it.

Thanks for all suggestions everyone.

--
Sincerely
Jose Alburquerque



Reply to: