Version 7 of pwd

Updated 2003-09-02 18:46:54

http://www.purl.org/tcl/home/man/tcl8.4/TclCmd/pwd.htm

'pwd' is always a fully normalized path (at least in Tcl 8.4a4 or newer). This differs from Tcl 8.3 or older, where (on some platforms at least) 'pwd' was whatever non-unique file representation was last passed to 'cd'. In Tcl8.4 'pwd' is guaranteed to be the unique normalized string representation of the path.

'pwd' may actually lie inside a virtual filesystem (and therefore be different to the OS'es perception of the pwd), if any are mounted.

'pwd' can actually change under some circumstances without the use of 'cd', for example if 'pwd' is inside a directory which is deleted with 'file delete -force', Tcl moves the pwd out of the directory before deleting.

Note that the current directory is unfortunately a process-resource - so if you're using multiple interps in an event-driven situation, relying on a particular working directory between calls may cause you grief. In fact even without multiple interps you shouldn't write procs that rely on a particular working directory as again, you could get unexpected results if calls are interleaved with other parts of your application.


Tcl syntax help - Arts and crafts of Tcl-Tk programming - Category Command