by selendym · 1y ago · 0 comments
PROMPT_COMMAND='_prev_status="$?"'
PS1='\n$(printf "%0${COLUMNS}d\n" 0 | tr 0 -)\n[\D{%y%m%d-%H%M%S}] \u@\H (${_prev_status})\n${PWD}\n\$ '
The first line saves the status of the previous command and the second line sets the prompt string.
The result is something like this: ---------------------------------------- <these dashes span the terminal width>
[date-time] user@host (status)
/current/working/directory
$ <next command>No comments yet.