bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: continuously evaluated prompts/environmental variables


From: Pierre Gaston
Subject: Re: continuously evaluated prompts/environmental variables
Date: Tue, 26 Nov 2013 10:38:14 +0200

On Tue, Nov 26, 2013 at 7:21 AM, Edward Peschko <horos11@gmail.com> wrote:

> All,
>
> I was wondering if there was a way to make an environmental variable
> be evaluated each time it was accessed. In other words, with:
>
> export PS1="`whoami`@`hostname`"
>
> This works for the first time that the prompt is evaluated, what I
> would like to have is a prompt to be continuously evaluated, so that
> if whoami or hostname changes, the prompt changes along with it.
>

Actually this works only once but when the prompt is defined.
Use single quotes so that the expansions are not done during the variable
assignment:
PS1='`whoami`@`hostname`'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]