[Help-bash] Expand a prompt string to calculate its length?
From:
Jesse Hathaway
Subject:
[Help-bash] Expand a prompt string to calculate its length?
Date:
Wed, 19 Jun 2019 13:09:33 -0500
Is there anyway to expand a partial prompt string to calculate its length?
For instance expand:
PS1='\h:\w$ '
# to
PS1='bubbles:~/tmp$'
For the purpose of determining its length, before displaying the prompt?
I would like to add a horizontal line to the first line of my PS1, but I need
to know the length of the PS1 prefix, in order to calculate the width of the
line.
Something like this:
|bubbles:~/tmp-----------------------------------------|
|$ |