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: Eric Blake
Subject: Re: How to run something before invoking the inputted command?
Date: Fri, 09 Jul 2010 21:30:23 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5

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.  Except for long-running processes, there won't
even be much difference in the timestamps.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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