I always thought of this tracking of your current directory to be shell magic just for the convenience of the user, eg an example (run on linux)

$ cd /usr/X11
$ pwd
/usr/X11
$ /bin/pwd
/usr/X11R6
$ ls -ld /usr/X11
lrwxrwxrwx   1 root     root            5 Oct 21  1999 /usr/X11 -> X11R6
But I see what you are saying in the case of the current directory being a deleted directory, eg :-
$ mkdir test
cd test
pwd ; /bin/pwd
/home/ncw/test
/home/ncw/test
rmdir .
$ pwd ; /bin/pwd
/home/ncw/test
/bin/pwd: cannot get current directory: No such file or directory
Anyway, getcwd() was what I expected Cwd to use, and I was very suprised to see this /bin/pwd thing!

Thanks for the explanation. I think from the above experinents /bin/pwd == getcwd() under linux, so on that platform at least it should be replaced with getcwd(). According to my man pages getcwd() is POSIX so pretty much any unix should support it now-a-days.


In reply to RE: /bin/pwd (Re: Taint checking) by ncw
in thread Taint checking, File::Find and Cwd by ncw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.