Is it possible to grab the previous line in a terminal (xterm-256color
alone would do) via ANSI sequences, tput
or the like? Say I have
$ pwd
/some/long/path
$ cd $(result)
i.e. a programmatic copy-paste (or something akin to Out[1]
in ipython
). There's https://github.com/rcaloras/bash-preexec (see https://superuser.com/a/175802/1193313) but I'm curious if there's a less invasive way.