#!/bin/bash # 'topline' prompt # init tput init tput clear function __row() { local COL local ROW IFS=';' read -sdR -p $'\E[6n' ROW COL echo "${ROW#*[}" } PS1="$RESET_CHARSET" PS1+='$(tput sc; tput cup 0 0; tput el)' PS1+="${BOLD_CYAN}\\u --{ ${BOLD_WHITE}" PS1+='$(date +%T)' PS1+="${BOLD_CYAN} }-- \\w" PS1+='$(tput rc)' # This fixes the cursor position in case "reset" is called. PS1+='$( [[ $(__row) -eq 1 ]] && tput cup 1 0)' PS1+="${RESET}\\$ "