[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposed Prompt Escapes
From: |
Ángel González |
Subject: |
Re: Proposed Prompt Escapes |
Date: |
Thu, 19 Nov 2015 03:21:38 +0100 |
Dennis Williamson wrote:
> Do you mean something like:
>
> PS1='$SECONDS '
Not exactly. $SECONDS is the number of seconds since the shell was
started. I am interested in the seconds elapsed by the last command.
It is a hacky solution, but it could be done with:
> PS1=''; PROMPT_COMMAND='printf "%s " $SECONDS; SECONDS=0'
> (along with shopt -o promptvars)
For anyone trying to follow this, the above line should have been
shopt -s promptvars (promptvars option is set by default)
Best regards