scy,
@scy@chaos.social avatar

Nice trick for retrieving the current cursor position in bash:

IFS=';' read -sdR -p $'\E6n' row col && echo "row ${row#*[} column $col"

https://unix.stackexchange.com/a/183121

This is not POSIX-compatible though because of the flags in read.

I've used this to add an empty line in front of all of my shell prompts, except when on the top of the screen (i.e. in a new shell).

https://codeberg.org/scy/dotfiles/commit/f18000298473f78540723224e8f73971e26996ac

[#Linux #bash #CLI #cursor #prompt #terminal

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines