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

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



José Alburquerque <jaalburquerque@cox.net> writes:

> Hi all.  I'm wondering if anyone knows how I might be able to execute
> the same command just before the execution of a command issued at the
> prompt of a bash shell.

If you're using bash, try something like this:

    PS1='@$SECONDS $ '
    PS4='@$SECONDS: '
    set -x

That will show you the number of seconds since the shell started up in
your prompt, and before running each command.  Plain seconds are nice
and easy to subtract; if you'd prefer a different format, see the
PROMPTING section of the bash(1) manpage.

----Scott.



Reply to: