Created
August 19, 2016 14:49
-
-
Save petercamfield/759d742149f3cf9fac253d0956dcdc57 to your computer and use it in GitHub Desktop.
Display the time and status of last command in BASH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prompt_command { | |
es=$? | |
tput sgr0 | |
tput sc | |
let xpos=$(tput cols)-10 | |
tput cuf $xpos | |
tput dim | |
if [ $es -eq 0 ] | |
then | |
tput setab 2 | |
else | |
tput setab 1 | |
fi | |
echo -n "$(date '+%T')" | |
tput rc | |
} | |
PROMPT_COMMAND=prompt_command |
Author
petercamfield
commented
Aug 19, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment