bash: How to evaluate PS1, PS2, ...?
- by Harry
Is there any way to 'evaluate' PS1, PS2, etc from within a bash script?
Although, I can use alternate means to get all elements of my current PS1, I would really like to be able to reuse its definition instead of using these alternate means.
For example,
=====================================
PS1 element --> Alternate means
=====================================
\u --> $USER
\h --> $HOSTNAME
\w --> $PWD
...
=====================================
I could very well use the 'alternate means' column in my script, but I don't want to. In my PS1, I, for example, use bold blue color via terminal escape sequences which I'd like to be able to simply reuse by evaluating PS1.