bug-bash
[Top][All Lists]
Advanced

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

Re: How to run something before invoking the inputted command?


From: Dave Rutherford
Subject: Re: How to run something before invoking the inputted command?
Date: Mon, 12 Jul 2010 08:33:01 -0400

On Mon, Jul 12, 2010 at 08:16, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
>> On Sat, Jul 10, 2010 at 11:30 AM, Eric Blake <eblake@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}.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]