Fabien Dubosson added the comment:

Thanks for the additional information!

> The 'cd' man page says that 'cd -P' should "perform actions equivalent to the 
> chdir() function".

Just wondering, do you know what is the function called by `cd`/`cd -L` then? 
It doesn't seems to be a bash internal tweak because `/usr/bin/pwd -L` is able 
to get the symlink path, and this binary is not part of bash.

> You'll have to make a case for it being useful enough to add.

The use case is for shells written in Python, like for instance `xonsh` [1,2]. 
Being powered by Python, the only way to change directory is by using 
`os.chdir()`. It is then not possible to mimic the bash `cd` function without 
using workarounds, like for instance storing the symlink path in a variable, 
and even this doesn't allow to use `/usr/bin/pwd -L` in scripts because it 
would always returns the physical location.

Having such described functions (yet to be named) would permit python shells to 
offer users differentiated `cd` and `cd -P` commands, as well as having `pwd 
-L` in scripts behaving the same than in traditional shells.

[1] http://xon.sh/
[2] https://github.com/xonsh/xonsh

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29635>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to