[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to run something before invoking the inputted command?
From: |
Clark J. Wang |
Subject: |
Re: How to run something before invoking the inputted command? |
Date: |
Sat, 10 Jul 2010 11:54:05 +0800 |
On Sat, Jul 10, 2010 at 11:30 AM, Eric Blake <eblake@redhat.com> wrote:
> On 07/09/2010 09:22 PM, Clark J. Wang wrote:
> > For example, in the interactive shell, I want to track the time when
> every
> > inputted command is invoked. So I want to run a `date' command before
> > actually invoking the inputted command. For now I have to do like this:
> >
> > $ date; command1
> > $ date; command2
> >
> > Is there an easy way to do that?
>
> 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.
Yes, timestamp in PS1 is fine for after-command purposes. And actually I use
the PROMPT_COMMAND var for that.
Except for long-running processes, there won't
> even be much difference in the timestamps.
>
> Looks like not a perfect solution. :)
> --
> Eric Blake eblake@redhat.com +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
>
>
- How to run something before invoking the inputted command?, Clark J. Wang, 2010/07/09
- Re: How to run something before invoking the inputted command?, Eric Blake, 2010/07/09
- Re: How to run something before invoking the inputted command?,
Clark J. Wang <=
- Re: How to run something before invoking the inputted command?, Greg Wooledge, 2010/07/12
- Re: How to run something before invoking the inputted command?, Dave Rutherford, 2010/07/12
- Re: How to run something before invoking the inputted command?, Clark J. Wang, 2010/07/12
- Re: How to run something before invoking the inputted command?, Greg Wooledge, 2010/07/13
- Re: How to run something before invoking the inputted command?, Clark J. Wang, 2010/07/13
Re: How to run something before invoking the inputted command?, Andreas Schwab, 2010/07/12