I am trying to make a software that determines my PS1 (my prompt) depending on the content of what's written in the terminal (limited to what I can see), to avoid cluttering my work space. For instance, if the terminal seems cluttered or are missing, reprint some info (path, user, host)
I am using GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
, though I don't know if it will change anything
Let's say my terminal looks like this right now :
I would like to get a variable with this content as a single string:
$ echo 1
1
$ echo 2
2
$ LANG= git status
fatal: not a git repository (or any of the parent directories): .git
$ echo 3
3
$ time
real 0m0,000s
user 0m0,000s
sys 0m0,000s
$ LANG= date
Fri Jan 6 13:17:37 CET 2023
$
Which I would forward to my program.
This question states it is impossible, but it seems to use the curses lib, so I don't know if it is related.
Read screen character from terminal
Bonus questions:
- should I ask this question in https://unix.stackexchange.com ?
- What is the name for "the seeable content of the terminal" ?