[PATCH 2/3] hust_test: Add missing PWD variable and improve checking mechanism
Denys Vlasenko
vda.linux at googlemail.com
Sat Sep 5 23:17:46 UTC 2009
On Thursday 13 August 2009 10:17, Mike Frysinger wrote:
> On Wednesday 12 August 2009 15:24:01 Denys Vlasenko wrote:
> > On Wed, Aug 12, 2009 at 3:56 PM, Michal Simek<monstr at monstr.eu> wrote:
> > > I am trying to run ltp on hush and runltp use PWD too. It will be better
> > > if hush will export PWD variable. I am not script specialist and don't
> > > have any statistic but seems to me it is common thing and shell should
> > > provide it. What do you think?
> >
> > hush currently has no support for special variables at all
> > (not counting $1, $_ etc). It makes sense to add it,
> > but it will take some time.
>
> it doesnt need to be special. export it when hush starts up like any other
> variable, and then update it whenever someone uses the `cd` builtin.
Done.
> side
> note -- setting PWD is the same thing as doing `cd`. so `PWD=/` and `cd /`
> are equivalent.
I discovered that it is not true (in bash).
Setting PWD does not do that. bash lies to you by showing wrong prompt:
shadow:~# PWD=/
shadow:/# PWD=/tmp
shadow:/tmp# /bin/pwd
/root
shadow:/# set | grep PS1
PS1='\h:\w\$ '
Apparently, \w simply is substituted by $PWD, even if the value is wrong.
--
vda
More information about the busybox
mailing list