bash: How to evaluate PS1, PS2, …? [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Echo expanded PS1 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