Subject: Re: sh not expanding vars
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 10/01/2002 20:02:00
In article <20021001205014.4bd9bdf9.jmmv@hispabsd.org>,
Julio Merino <jmmv@hispabsd.org> wrote:
>Hello
>
>This cames from the discussion of sh/ksh... hehe.
>
>The following works properly in ksh:
>
>export PS1="\`pwd\`$ "
>
>It will get pwd's value each time it gets PS1's value. Although,
>this fails in sh and you get the string `pwd`$ unexpanded as your
>prompt. Another example:
>
>export ENV="\$HOME/.env"
>
>Will work in ksh, reading root's .env (for example) when issuing
>a non-login su. It won't work in sh.
>
>Which is the correct behavior? ksh's or sh's one?
>
>Thanks.
Both? Traditional sh does not eval $PS1 each time, whereas ksh does.
What does Posix say?
christos