On Mon, Jul 12, 2010 at 08:16, Greg Wooledge <wool...@eeg.ccf.org> wrote: >> On Sat, Jul 10, 2010 at 11:30 AM, Eric Blake <ebl...@redhat.com> wrote: >> > Not quite before the command, but it is very easy to include $(date) as >> > part of PS1 to have a timestamp listed in the prompt that is printed >> > after every command. > > On Sat, Jul 10, 2010 at 11:54:05AM +0800, Clark J. Wang wrote: >> Yes, timestamp in PS1 is fine for after-command purposes. And actually I use >> the PROMPT_COMMAND var for that. > > unset PROMPT_COMMAND > PS1='$(date +%H:%M:%S)|\h:\w\$ '
Why not just use the \t escape in PS1? Or, if you want other arguments to strftime, you could write \D{%H:%M:%S}.