[email protected] wrote:
> Having the information in an env variable would make it useful in
> scripts. The only thing I'm not sure of is can the $RDOMAIN variable be
> used to show the current rdomain in the prompt? (which is my use case)
> If it's not possible to use an env variable in the PS1 prompt, then does
> it make sense to have both? Doing a quick test with 'export
> PS1="$RANDOM \h\\$ "' then running 'echo $RANDOM' multiple times, value
> in the prompt is static, but the output of echo behaves as expected. Is
> my test valid?
that's because of the quoting. $RANDOM gets substituted once in before
PS1 is defined. If you change the quoting to preserve the variable,
then is re-executed each time
% PS1='$RANDOM % '
11102 %
24319 %
24714 %
12763 %
16127 %
28099 %