I am comparing the output of a very simple script run on 2 different windows 2003 machines in directory c:\temp. Both machines have similar dual implementations of perl (5.6.1 and 5.8.8). The 5.6.1 is part of a separate independent application install. There are many administration related scripts written for this separate independent application that utilize this 5.6.1 implementation. The 5.8.8 is the release all our corporate custom scripts use.
# use Cwd; print "\ncd=" . `cd`; print "\ngetcwd=" . getcwd(); #
On machine1, I get what you would expect ... both print outputs are "c:\temp". However, on machine2 when I use version 5.8.8 the script returns what one would expect, but when it uses the 5.6.1 install, it returns "cd=c:\" and "c:\temp". Why in the world could it be different? How I found this was when I was using one of the before mentioned administration scripts, I kept receiving a "file not found" error. After quite a while of debugging, I found the calls and soon learned that if I moved the file to c:\, the files were then found and the script would run fine. I then narrowed down the symptoms to the above statements so I wouldn't have to wade through a lot of residual noise. One of the things I tried to try to change the outcome was to just add a chdir command. However, it did not work since it still returned "c:\" for the first print output and "c:\temp\ldif" for the second.
# use Cwd; chdir 'c:\temp\ldif'; print "\ncd=" . `cd`; print "\ngetcwd=" . getcwd(); #
I have tried it on other machines as well with similar "dual implementations". Most returned the expected consistent results. However, one other machine returned the inconsistent result. The only thing I could see which was similar with machine 2 was both had SFU (windows services for unix) installed. So, I tried to uninstall SFU on machine 2 and restart. Unfortunately it did not help. I have reviewed all environmental vars on the two machines and now that SFU is no longer installed, there are no significant differences. Has anyone experienced anything similar? Could anyone suggest where I might look next? Thanks, BLC SoCal

In reply to cd pwd dir chdir version default directory by blc3355447

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.