TK wrote:

Lets say:

PS1="[${INSTALL_DIR##*/}]"

Bash is able to evalute it for the first time; but later, after INSTALL_DIR's value changes, Bash prompt wouldn't change accordingly. So is there a systematic way to force BASH to reflect the change?

Thanks.
-tk


5 minutes after sending out the email, I think I've just found the answer:
PS1="[\${INSTALL_DIR##*/}]"

The reason seems to be that "\$" makes a literal "$" so shell doesn't expand the "${}" immediately, which gives it a second chance for evaluation upon each new prompt.

Shell expansion/substitution has been confusing to me, since the KSH days, and it continues to be :)

-tk



--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to