[Toybox] Add remaining pwd options

Felix Janda felix.janda at posteo.de
Tue Jan 1 04:49:00 PST 2013


On 12/31/12 at 09:50pm, Rob Landley wrote:
> On 12/31/2012 10:39:18 AM, Felix Janda wrote:
> > On 12/30/12 at 05:47pm, Rob Landley wrote:
> > > On 12/30/2012 05:16:41 AM, Felix Janda wrote:
> > > > On 12/30/12 at 04:43am, Rob Landley wrote:
> > > > POSIX contains many surprises. In the section on environment
> > > > variables it
> > > > says that $PWD should be set if "pwd -P" was specified. What  
> > happens
> > > > if an
> > > > error happens seems unspecified.
> > 
> > Sorry, this is wrong. It has been changed between SUSV4 and SUSV3.  
> > Now pwd
> > must not change $PWD. (It would be really nice to have SUSV4 man  
> > pages...)
> 
> There are susv4 web pages which you can download and pull up with  
> "links" or similar if it really bothers you.

Having something like "man 1p pwd" is just too convenient.

> Trying to beat sane behavior out of bash is not a fruitful endeavor:
> 
>    cd
>    mkdir missing
>    cd missing
>    rmdir ../missing
>    pwd -P
>    cd ..
>    ls
>    echo $PWD
> 
> I'm not copying that behavior.

Of course, me neither. bash seems still to try to follow the older version
of POSIX, but its version of "pwd -P" seems to be broken in another way.


Do I understand correctly that in the case that pwd (as a builtin of toysh)
can't determine the path of the current working directory with getcwd() it
should fall back to printing $PWD?


BTW, in the case that one has deleted and recreated one's current working
directory one could also use "cd ." to get to the new directory.

Felix

 1357044540.0


More information about the Toybox mailing list